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-10-27 10:58:38 -04:00
parent 6825ae319e
commit 2d53ff29c5
106 changed files with 3070 additions and 1567 deletions

View file

@ -1,6 +1,6 @@
{
"name": "paper-dropdown-menu",
"version": "1.0.4",
"version": "1.0.5",
"description": "An element that works similarly to a native browser select",
"authors": [
"The Polymer Authors"
@ -28,7 +28,9 @@
"paper-input": "polymerelements/paper-input#^1.0.9",
"paper-menu-button": "polymerelements/paper-menu-button#^1.0.0",
"paper-ripple": "polymerelements/paper-ripple#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0"
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0",
"iron-validatable-behavior": "PolymerElements/iron-validatable-behavior#^1.0.0"
},
"devDependencies": {
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
@ -40,11 +42,11 @@
"web-component-tester": "*",
"paper-tabs": "polymerelements/paper-tabs#^1.0.0"
},
"_release": "1.0.4",
"_release": "1.0.5",
"_resolution": {
"type": "version",
"tag": "v1.0.4",
"commit": "b278c9ea1b3642c77bd4597a28b39a61996a5a9e"
"tag": "v1.0.5",
"commit": "63b8200dc68ce297dcf2000a60587f3f68464f31"
},
"_source": "git://github.com/PolymerElements/paper-dropdown-menu.git",
"_target": "~1.0.1",

View file

@ -1,6 +1,6 @@
{
"name": "paper-dropdown-menu",
"version": "1.0.4",
"version": "1.0.5",
"description": "An element that works similarly to a native browser select",
"authors": [
"The Polymer Authors"
@ -28,7 +28,9 @@
"paper-input": "polymerelements/paper-input#^1.0.9",
"paper-menu-button": "polymerelements/paper-menu-button#^1.0.0",
"paper-ripple": "polymerelements/paper-ripple#^1.0.0",
"paper-styles": "polymerelements/paper-styles#^1.0.0"
"paper-styles": "polymerelements/paper-styles#^1.0.0",
"iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0",
"iron-validatable-behavior": "PolymerElements/iron-validatable-behavior#^1.0.0"
},
"devDependencies": {
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",

View file

@ -19,8 +19,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../iron-icons/iron-icons.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<link rel="import" href="../iron-selector/iron-selectable.html">
<link rel="import" href="../iron-form-element-behavior/iron-form-element-behavior.html">
<link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.html">
<!--
Material design: [Dropdown menus](https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons)
`paper-dropdown-menu` is similar to a native browser select element.
`paper-dropdown-menu` works with selectable content. The currently selected
item is displayed in the control. If no item is selected, the `label` is
@ -108,16 +112,17 @@ respectively.
}
paper-ripple {
top: 20px;
left: 8px;
bottom: 16px;
right: 8px;
top: 12px;
left: 0px;
bottom: 8px;
right: 0px;
@apply(--paper-dropdown-menu-ripple);
}
paper-menu-button {
display: block;
padding: 0;
@apply(--paper-dropdown-menu-button);
}
@ -146,6 +151,7 @@ respectively.
<div class="dropdown-trigger">
<paper-ripple></paper-ripple>
<paper-input
invalid="[[invalid]]"
readonly
disabled="[[disabled]]"
value="[[selectedItemLabel]]"
@ -181,7 +187,9 @@ respectively.
behaviors: [
Polymer.IronControlState,
Polymer.IronButtonState
Polymer.IronButtonState,
Polymer.IronFormElementBehavior,
Polymer.IronValidatableBehavior
],
properties: {
@ -193,7 +201,7 @@ respectively.
selectedItemLabel: {
type: String,
notify: true,
computed: '_computeSelectedItemLabel(selectedItem)'
readOnly: true
},
/**
@ -209,6 +217,17 @@ respectively.
readOnly: true
},
/**
* The value for this element that will be used when submitting in
* a form. It is read only, and will always have the same value
* as `selectedItemLabel`.
*/
value: {
type: String,
notify: true,
readOnly: true
},
/**
* The label for the dropdown.
*/
@ -275,6 +294,10 @@ respectively.
'aria-haspopup': 'true'
},
observers: [
'_selectedItemChanged(selectedItem)'
],
attached: function() {
// NOTE(cdata): Due to timing, a preselected value in a `IronSelectable`
// child will cause an `iron-select` event to fire while the element is
@ -342,12 +365,16 @@ respectively.
* @param {Element} selectedItem A selected Element item, with an
* optional `label` property.
*/
_computeSelectedItemLabel: function(selectedItem) {
_selectedItemChanged: function(selectedItem) {
var value = '';
if (!selectedItem) {
return '';
value = '';
} else {
value = selectedItem.label || selectedItem.textContent.trim();
}
return selectedItem.label || selectedItem.textContent.trim();
this._setValue(value);
this._setSelectedItemLabel(value);
},
/**
@ -362,7 +389,17 @@ respectively.
// derived from the metrics of elements internal to `paper-input`'s
// template. The metrics will change depending on whether or not the
// input has a floating label.
return noLabelFloat ? -4 : 16;
return noLabelFloat ? -4 : 8;
},
/**
* Returns false if the element is required and does not have a selection,
* and true otherwise.
* @return {Boolean} true if `required` is false, or if `required` is true
* and the element has a valid selection.
*/
_getValidity: function() {
return this.disabled || !this.required || (this.required && this.value);
}
});
})();

View file

@ -133,6 +133,43 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
expect(dropdownMenu.selectedItem).to.be.equal(null);
});
});
suite('validation', function() {
test('a non required dropdown is valid regardless of its selection', function() {
var dropdownMenu = fixture('TrivialDropdownMenu');
menu = Polymer.dom(dropdownMenu).querySelector('.dropdown-content');
// no selection.
expect(dropdownMenu.validate()).to.be.true;
expect(dropdownMenu.invalid).to.be.false;
expect(dropdownMenu.value).to.not.be.ok;
// some selection.
menu.selected = 1;
expect(dropdownMenu.validate()).to.be.true;
expect(dropdownMenu.invalid).to.be.false;
expect(dropdownMenu.value).to.be.equal('Bar');
});
test('a required dropdown is invalid without a selection', function() {
var dropdownMenu = fixture('TrivialDropdownMenu');
dropdownMenu.required = true;
// no selection.
expect(dropdownMenu.validate()).to.be.false;
expect(dropdownMenu.invalid).to.be.true;
expect(dropdownMenu.value).to.not.be.ok;
});
test('a required dropdown is valid with a selection', function() {
var dropdownMenu = fixture('PreselectedDropdownMenu');
dropdownMenu.required = true;
expect(dropdownMenu.validate()).to.be.true;
expect(dropdownMenu.invalid).to.be.false;
expect(dropdownMenu.value).to.be.equal('Bar');
});
});
});
</script>