mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update polymer
This commit is contained in:
parent
8119b930e4
commit
cbb6337b41
74 changed files with 2195 additions and 1393 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-behaviors",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Common behaviors across the paper elements",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -25,6 +25,7 @@
|
|||
"homepage": "https://github.com/PolymerElements/paper-behaviors",
|
||||
"dependencies": {
|
||||
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
|
||||
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -36,11 +37,11 @@
|
|||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.0.4",
|
||||
"_release": "1.0.5",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "a7ac7fbdb79b4d82416ec9b41613575386d0d226"
|
||||
"tag": "v1.0.5",
|
||||
"commit": "57b4ddedf6fa54171d0c9d078f340399724bfe4e"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-behaviors.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-behaviors",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"description": "Common behaviors across the paper elements",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -25,6 +25,7 @@
|
|||
"homepage": "https://github.com/PolymerElements/paper-behaviors",
|
||||
"dependencies": {
|
||||
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
|
||||
"iron-checked-element-behavior": "PolymerElements/iron-checked-element-behavior#^1.0.0",
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -18,6 +18,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
:host {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
background-color: #4285F4;
|
||||
color: #fff;
|
||||
border-radius: 3px;
|
||||
|
|
|
@ -10,7 +10,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../paper-ripple/paper-ripple.html">
|
||||
<link rel="import" href="../paper-inky-focus-behavior.html">
|
||||
<link rel="import" href="../paper-checked-element-behavior.html">
|
||||
|
||||
<dom-module id="paper-radio-button">
|
||||
|
||||
|
@ -89,7 +89,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<div id="radioContainer">
|
||||
<div id="offRadio"></div>
|
||||
<div id="onRadio"></div>
|
||||
<paper-ripple id="ink" class="circle" center></paper-ripple>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -98,7 +97,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
Polymer({
|
||||
|
||||
behaviors: [
|
||||
Polymer.PaperInkyFocusBehavior
|
||||
Polymer.PaperCheckedElementBehavior
|
||||
],
|
||||
|
||||
hostAttributes: {
|
||||
|
@ -107,6 +106,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
ready: function() {
|
||||
this.toggles = true;
|
||||
},
|
||||
|
||||
_createRipple: function() {
|
||||
this._rippleContainer = this.$.radioContainer;
|
||||
return Polymer.PaperInkyFocusBehaviorImpl._createRipple.call(this);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -10,27 +10,41 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-behaviors/iron-button-state.html">
|
||||
<link rel="import" href="paper-ripple-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
/** @polymerBehavior */
|
||||
/** @polymerBehavior Polymer.PaperButtonBehavior */
|
||||
Polymer.PaperButtonBehaviorImpl = {
|
||||
|
||||
properties: {
|
||||
|
||||
_elevation: {
|
||||
type: Number
|
||||
/**
|
||||
* The z-depth of this element, from 0-5. Setting to 0 will remove the
|
||||
* shadow, and each increasing number greater than 0 will be "deeper"
|
||||
* than the last.
|
||||
*
|
||||
* @attribute elevation
|
||||
* @type number
|
||||
* @default 1
|
||||
*/
|
||||
elevation: {
|
||||
type: Number,
|
||||
reflectToAttribute: true,
|
||||
readOnly: true
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)'
|
||||
'_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)',
|
||||
'_computeKeyboardClass(receivedFocusFromKeyboard)'
|
||||
],
|
||||
|
||||
hostAttributes: {
|
||||
role: 'button',
|
||||
tabindex: '0'
|
||||
tabindex: '0',
|
||||
animated: true
|
||||
},
|
||||
|
||||
_calculateElevation: function() {
|
||||
|
@ -42,14 +56,42 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
} else if (this.receivedFocusFromKeyboard) {
|
||||
e = 3;
|
||||
}
|
||||
this._elevation = e;
|
||||
this._setElevation(e);
|
||||
},
|
||||
|
||||
_computeKeyboardClass: function(receivedFocusFromKeyboard) {
|
||||
this.classList.toggle('keyboard-focus', receivedFocusFromKeyboard);
|
||||
},
|
||||
|
||||
/**
|
||||
* In addition to `IronButtonState` behavior, when space key goes down,
|
||||
* create a ripple down effect.
|
||||
*/
|
||||
_spaceKeyDownHandler: function(event) {
|
||||
Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this, event);
|
||||
if (this.hasRipple()) {
|
||||
this._ripple.uiDownAction();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* In addition to `IronButtonState` behavior, when space key goes up,
|
||||
* create a ripple up effect.
|
||||
*/
|
||||
_spaceKeyUpHandler: function(event) {
|
||||
Polymer.IronButtonStateImpl._spaceKeyUpHandler.call(this, event);
|
||||
if (this.hasRipple()) {
|
||||
this._ripple.uiUpAction();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** @polymerBehavior */
|
||||
Polymer.PaperButtonBehavior = [
|
||||
Polymer.IronButtonState,
|
||||
Polymer.IronControlState,
|
||||
Polymer.PaperRippleBehavior,
|
||||
Polymer.PaperButtonBehaviorImpl
|
||||
];
|
||||
|
||||
|
|
61
dashboard-ui/bower_components/paper-behaviors/paper-checked-element-behavior.html
vendored
Normal file
61
dashboard-ui/bower_components/paper-behaviors/paper-checked-element-behavior.html
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-checked-element-behavior/iron-checked-element-behavior.html">
|
||||
<link rel="import" href="paper-inky-focus-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* Use `Polymer.PaperCheckedElementBehavior` to implement a custom element
|
||||
* that has a `checked` property similar to `Polymer.IronCheckedElementBehavior`
|
||||
* and is compatible with having a ripple effect.
|
||||
* @polymerBehavior Polymer.PaperCheckedElementBehavior
|
||||
*/
|
||||
Polymer.PaperCheckedElementBehaviorImpl = {
|
||||
|
||||
/**
|
||||
* Synchronizes the element's checked state with its ripple effect.
|
||||
*/
|
||||
_checkedChanged: function() {
|
||||
Polymer.IronCheckedElementBehaviorImpl._checkedChanged.call(this);
|
||||
if (this.hasRipple()) {
|
||||
if (this.checked) {
|
||||
this._ripple.setAttribute('checked', '');
|
||||
} else {
|
||||
this._ripple.removeAttribute('checked');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Synchronizes the element's `active` and `checked` state.
|
||||
*/
|
||||
_buttonStateChanged: function() {
|
||||
Polymer.PaperRippleBehavior._buttonStateChanged.call(this);
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
if (this.isAttached) {
|
||||
this.checked = this.active;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/** @polymerBehavior Polymer.PaperCheckedElementBehavior */
|
||||
Polymer.PaperCheckedElementBehavior = [
|
||||
Polymer.PaperInkyFocusBehavior,
|
||||
Polymer.IronCheckedElementBehavior,
|
||||
Polymer.PaperCheckedElementBehaviorImpl
|
||||
];
|
||||
|
||||
</script>
|
|
@ -10,13 +10,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-behaviors/iron-button-state.html">
|
||||
<link rel="import" href="paper-ripple-behavior.html">
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* `Polymer.PaperInkyFocusBehavior` implements a ripple when the element has keyboard focus.
|
||||
*
|
||||
* @polymerBehavior Polymer.PaperInkyFocusBehavior
|
||||
* @polymerBehavior Polymer.PaperInkyFocusBehaviorImpl
|
||||
*/
|
||||
Polymer.PaperInkyFocusBehaviorImpl = {
|
||||
|
||||
|
@ -25,11 +26,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
],
|
||||
|
||||
_focusedChanged: function(receivedFocusFromKeyboard) {
|
||||
if (!this.$.ink) {
|
||||
return;
|
||||
if (receivedFocusFromKeyboard) {
|
||||
this.ensureRipple();
|
||||
}
|
||||
if (this.hasRipple()) {
|
||||
this._ripple.holdDown = receivedFocusFromKeyboard;
|
||||
}
|
||||
},
|
||||
|
||||
this.$.ink.holdDown = receivedFocusFromKeyboard;
|
||||
_createRipple: function() {
|
||||
var ripple = Polymer.PaperRippleBehavior._createRipple();
|
||||
ripple.id = 'ink';
|
||||
ripple.setAttribute('center', '');
|
||||
ripple.classList.add('circle');
|
||||
return ripple;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -38,6 +48,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
Polymer.PaperInkyFocusBehavior = [
|
||||
Polymer.IronButtonState,
|
||||
Polymer.IronControlState,
|
||||
Polymer.PaperRippleBehavior,
|
||||
Polymer.PaperInkyFocusBehaviorImpl
|
||||
];
|
||||
|
||||
|
|
117
dashboard-ui/bower_components/paper-behaviors/paper-ripple-behavior.html
vendored
Normal file
117
dashboard-ui/bower_components/paper-behaviors/paper-ripple-behavior.html
vendored
Normal file
|
@ -0,0 +1,117 @@
|
|||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../paper-ripple/paper-ripple.html">
|
||||
|
||||
<script>
|
||||
|
||||
/**
|
||||
* `Polymer.PaperRippleBehavior` dynamically implements a ripple
|
||||
* when the element has focus via pointer or keyboard.
|
||||
*
|
||||
* NOTE: This behavior is intended to be used in conjunction with and after
|
||||
* `Polymer.IronButtonState` and `Polymer.IronControlState`.
|
||||
*
|
||||
* @polymerBehavior Polymer.PaperRippleBehavior
|
||||
*/
|
||||
Polymer.PaperRippleBehavior = {
|
||||
|
||||
properties: {
|
||||
/**
|
||||
* If true, the element will not produce a ripple effect when interacted
|
||||
* with via the pointer.
|
||||
*/
|
||||
noink: {
|
||||
type: Boolean,
|
||||
observer: '_noinkChanged'
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensures a `<paper-ripple>` element is available when the element is
|
||||
* focused.
|
||||
*/
|
||||
_buttonStateChanged: function() {
|
||||
if (this.focused) {
|
||||
this.ensureRipple();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* In addition to the functionality provided in `IronButtonState`, ensures
|
||||
* a ripple effect is created when the element is in a `pressed` state.
|
||||
*/
|
||||
_downHandler: function(event) {
|
||||
Polymer.IronButtonStateImpl._downHandler.call(this, event);
|
||||
if (this.pressed) {
|
||||
this.ensureRipple(event);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Ensures this element contains a ripple effect. For startup efficiency
|
||||
* the ripple effect is dynamically on demand when needed.
|
||||
* @param {event} triggeringEvent (optional) event that triggered the
|
||||
* ripple.
|
||||
*/
|
||||
ensureRipple: function(triggeringEvent) {
|
||||
if (!this.hasRipple()) {
|
||||
this._ripple = this._createRipple();
|
||||
this._ripple.noink = this.noink;
|
||||
var rippleContainer = this._rippleContainer || this.root;
|
||||
if (rippleContainer) {
|
||||
Polymer.dom(rippleContainer).appendChild(this._ripple);
|
||||
}
|
||||
var domContainer = rippleContainer === this.shadyRoot ? this :
|
||||
rippleContainer;
|
||||
if (triggeringEvent && domContainer.contains(triggeringEvent.target)) {
|
||||
this._ripple.uiDownAction(triggeringEvent);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the `<paper-ripple>` element used by this element to create
|
||||
* ripple effects. The element's ripple is created on demand, when
|
||||
* necessary, and calling this method will force the
|
||||
* ripple to be created.
|
||||
*/
|
||||
getRipple: function() {
|
||||
this.ensureRipple();
|
||||
return this._ripple;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if this element currently contains a ripple effect.
|
||||
* @return {boolean}
|
||||
*/
|
||||
hasRipple: function() {
|
||||
return Boolean(this._ripple);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create the element's ripple effect via creating a `<paper-ripple>`.
|
||||
* Override this method to customize the ripple element.
|
||||
* @return {element} Returns a `<paper-ripple>` element.
|
||||
*/
|
||||
_createRipple: function() {
|
||||
return document.createElement('paper-ripple');
|
||||
},
|
||||
|
||||
_noinkChanged: function(noink) {
|
||||
if (this.hasRipple()) {
|
||||
this._ripple.noink = noink;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
</script>
|
|
@ -19,7 +19,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<script>
|
||||
WCT.loadSuites([
|
||||
'paper-button-behavior.html',
|
||||
'paper-radio-button-behavior.html'
|
||||
'paper-radio-button-behavior.html',
|
||||
'paper-checked-element-behavior.html',
|
||||
'paper-ripple-behavior.html'
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -39,19 +39,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
|
||||
test('normal (no states)', function() {
|
||||
assert.equal(button._elevation, 1);
|
||||
assert.equal(button.elevation, 1);
|
||||
});
|
||||
|
||||
test('set disabled property', function() {
|
||||
button.disabled = true;
|
||||
assert.equal(button._elevation, 0);
|
||||
assert.equal(button.elevation, 0);
|
||||
});
|
||||
|
||||
test('pressed and released', function() {
|
||||
MockInteractions.down(button);
|
||||
assert.equal(button._elevation, 4);
|
||||
assert.equal(button.elevation, 4);
|
||||
MockInteractions.up(button);
|
||||
assert.equal(button._elevation, 1);
|
||||
assert.equal(button.elevation, 1);
|
||||
assert.ok(button.hasRipple());
|
||||
});
|
||||
|
||||
suite('a button with toggles', function() {
|
||||
|
@ -62,7 +63,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
test('activated by tap', function(done) {
|
||||
MockInteractions.downAndUp(button, function() {
|
||||
try {
|
||||
assert.equal(button._elevation, 4);
|
||||
assert.equal(button.elevation, 4);
|
||||
assert.ok(button.hasRipple());
|
||||
done();
|
||||
} catch (e) {
|
||||
done(e);
|
||||
|
@ -73,7 +75,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
test('receives focused', function() {
|
||||
MockInteractions.focus(button);
|
||||
assert.equal(button._elevation, 3);
|
||||
assert.equal(button.elevation, 3);
|
||||
assert.ok(button.hasRipple());
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
94
dashboard-ui/bower_components/paper-behaviors/test/paper-checked-element-behavior.html
vendored
Normal file
94
dashboard-ui/bower_components/paper-behaviors/test/paper-checked-element-behavior.html
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-checked-element-behavior</title>
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../paper-checked-element-behavior.html">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<dom-module id="test-checked">
|
||||
<template>
|
||||
</template>
|
||||
<script>
|
||||
HTMLImports.whenReady(function() {
|
||||
Polymer({
|
||||
is: 'test-checked',
|
||||
behaviors: [
|
||||
Polymer.PaperCheckedElementBehavior
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<test-fixture id="basic">
|
||||
<template>
|
||||
<test-checked></test-checked>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('PaperCheckedElementBehavior', function() {
|
||||
var checked;
|
||||
|
||||
setup(function() {
|
||||
checked = fixture('basic');
|
||||
});
|
||||
|
||||
test('element checked when tapped to check', function() {
|
||||
MockInteractions.tap(checked);
|
||||
assert.isTrue(checked.checked);
|
||||
});
|
||||
|
||||
test('element checked when active', function() {
|
||||
checked.active = true;
|
||||
assert.isTrue(checked.checked);
|
||||
});
|
||||
|
||||
test('element not checked when disabled and made active', function() {
|
||||
checked.disabled = true;
|
||||
checked.active = true;
|
||||
assert.isFalse(checked.checked);
|
||||
});
|
||||
|
||||
test('element not checked when disabled and tapped', function() {
|
||||
checked.disabled = true;
|
||||
MockInteractions.tap(checked);
|
||||
assert.isFalse(checked.checked);
|
||||
});
|
||||
|
||||
test('element ripple has checked attribute when element tapped to check', function() {
|
||||
MockInteractions.tap(checked);
|
||||
assert.isTrue(checked.hasRipple());
|
||||
assert.isTrue(checked.getRipple().hasAttribute('checked'));
|
||||
});
|
||||
|
||||
test('element ripple does not have checked attribute when element tapped to uncheck', function() {
|
||||
MockInteractions.tap(checked);
|
||||
MockInteractions.tap(checked);
|
||||
assert.isFalse(checked.getRipple().hasAttribute('checked'));
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -33,26 +33,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<script>
|
||||
suite('basic', function() {
|
||||
var button;
|
||||
var ink;
|
||||
|
||||
setup(function() {
|
||||
button = fixture('basic');
|
||||
ink = button.querySelector('paper-ripple');
|
||||
MockInteractions.blur(button);
|
||||
});
|
||||
|
||||
test('normal (no states)', function() {
|
||||
assert.isFalse(button.focused);
|
||||
assert.isFalse(ink._animating);
|
||||
assert.equal(ink.ripples.length, 0);
|
||||
assert.isFalse(button.hasRipple());
|
||||
});
|
||||
|
||||
test('receives focus', function() {
|
||||
MockInteractions.focus(button);
|
||||
|
||||
assert.isTrue(button.focused);
|
||||
assert.isTrue(ink._animating);
|
||||
assert.equal(ink.ripples.length, 1);
|
||||
assert.isTrue(button.hasRipple());
|
||||
});
|
||||
|
||||
});
|
||||
|
|
82
dashboard-ui/bower_components/paper-behaviors/test/paper-ripple-behavior.html
vendored
Normal file
82
dashboard-ui/bower_components/paper-behaviors/test/paper-ripple-behavior.html
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-ripple-behavior</title>
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../../iron-behaviors/iron-button-state.html">
|
||||
<link rel="import" href="../paper-ripple-behavior.html">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<dom-module id="test-ripple">
|
||||
<template>
|
||||
</template>
|
||||
<script>
|
||||
HTMLImports.whenReady(function() {
|
||||
Polymer({
|
||||
is: 'test-ripple',
|
||||
behaviors: [
|
||||
Polymer.IronButtonState,
|
||||
Polymer.IronControlState,
|
||||
Polymer.PaperRippleBehavior
|
||||
]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<test-fixture id="basic">
|
||||
<template>
|
||||
<test-ripple></test-ripple>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('PaperRippleBehavior', function() {
|
||||
var ripple;
|
||||
|
||||
setup(function() {
|
||||
ripple = fixture('basic');
|
||||
});
|
||||
|
||||
test('no ripple at startup', function() {
|
||||
assert.isFalse(ripple.hasRipple());
|
||||
});
|
||||
|
||||
test('calling getRipple returns ripple', function() {
|
||||
assert.ok(ripple.getRipple());
|
||||
});
|
||||
|
||||
test('focus generates ripple', function() {
|
||||
MockInteractions.focus(ripple);
|
||||
assert.ok(ripple.hasRipple());
|
||||
});
|
||||
|
||||
test('down generates ripple', function() {
|
||||
MockInteractions.down(ripple);
|
||||
assert.ok(ripple.hasRipple());
|
||||
MockInteractions.up(ripple);
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -9,7 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
-->
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../paper-inky-focus-behavior.html">
|
||||
<link rel="import" href="../paper-checked-element-behavior.html">
|
||||
<link rel="import" href="../../paper-ripple/paper-ripple.html">
|
||||
|
||||
<dom-module id="test-radio-button">
|
||||
|
@ -35,7 +35,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
is: 'test-radio-button',
|
||||
|
||||
behaviors: [
|
||||
Polymer.PaperInkyFocusBehavior
|
||||
Polymer.PaperCheckedElementBehavior
|
||||
]
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue