1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update polymer

This commit is contained in:
Luke Pulverenti 2015-11-17 11:35:09 -05:00
parent 64e22073e0
commit 3223d4672a
55 changed files with 359 additions and 253 deletions

View file

@ -1,6 +1,6 @@
{
"name": "iron-checked-element-behavior",
"version": "1.0.2",
"version": "1.0.3",
"description": "Implements an element that has a checked attribute and can be added to a form",
"authors": "The Polymer Authors",
"keywords": [
@ -9,9 +9,7 @@
"iron",
"behavior"
],
"main": [
"iron-checked-element-behavior.html"
],
"main": "iron-checked-element-behavior.html",
"private": true,
"repository": {
"type": "git",
@ -33,11 +31,11 @@
"web-component-tester": "*",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.0.2",
"_release": "1.0.3",
"_resolution": {
"type": "version",
"tag": "v1.0.2",
"commit": "975b9f22ebd89ef457491fcc44cb86b660fc42cd"
"tag": "v1.0.3",
"commit": "5a0520d20eb8883076ce64117f2726ba209ebc97"
},
"_source": "git://github.com/PolymerElements/iron-checked-element-behavior.git",
"_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{
"name": "iron-checked-element-behavior",
"version": "1.0.2",
"version": "1.0.3",
"description": "Implements an element that has a checked attribute and can be added to a form",
"authors": "The Polymer Authors",
"keywords": [
@ -9,9 +9,7 @@
"iron",
"behavior"
],
"main": [
"iron-checked-element-behavior.html"
],
"main": "iron-checked-element-behavior.html",
"private": true,
"repository": {
"type": "git",

View file

@ -56,7 +56,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/* Overriden from Polymer.IronFormElementBehavior */
value: {
type: String,
value: ''
value: 'on',
observer: '_valueChanged'
}
},
@ -64,6 +65,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'_requiredChanged(required)'
],
created: function() {
// Used by `iron-form` to handle the case that an element with this behavior
// doesn't have a role of 'checkbox' or 'radio', but should still only be
// included when the form is serialized if `this.checked === true`.
this._hasIronCheckedElementBehavior = true;
},
/**
* Returns false if the element is required and not checked, and true otherwise.
* @return {boolean} true if `required` is false, or if `required` and `checked` are both true.
@ -84,15 +92,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
/**
* Update the element's value when checked.
* Fire `iron-changed` when the checked state changes.
*/
_checkedChanged: function() {
this.active = this.checked;
// Unless the user has specified a value, a checked element has the
// default value "on" when checked.
if (this.value === '')
this.value = this.checked ? 'on' : '';
this.fire('iron-change');
},
/**
* Reset value to 'on' if it is set to `undefined`.
*/
_valueChanged: function() {
if (this.value === undefined || this.value === null) {
this.value = 'on';
}
}
};

View file

@ -84,9 +84,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assert.isFalse(c.invalid);
});
test('has a default value of "on" when checked', function() {
test('has a default value of "on", always', function() {
var c = fixture('basic');
assert.isTrue(c.value === '');
assert.isTrue(c.value === 'on');
c.checked = true;
assert.isTrue(c.value === 'on');
@ -99,6 +100,32 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
c.checked = true;
assert.isTrue(c.value === 'batman');
});
test('value returns "on" when no explicit value is specified', function() {
var c = fixture('basic');
assert.equal(c.value, 'on', 'returns "on"');
});
test('value returns the value when an explicit value is set', function() {
var c = fixture('basic');
c.value = 'abc';
assert.equal(c.value, 'abc', 'returns "abc"');
c.value = '123';
assert.equal(c.value, '123', 'returns "123"');
});
test('value returns "on" when value is set to undefined', function() {
var c = fixture('basic');
c.value = 'abc';
assert.equal(c.value, 'abc', 'returns "abc"');
c.value = undefined;
assert.equal(c.value, 'on', 'returns "on"');
});
});
suite('a11y', function() {