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

update detail screens

This commit is contained in:
Luke Pulverenti 2015-08-19 00:08:03 -04:00
parent 7b42686295
commit f5323ff3c2
34 changed files with 682 additions and 658 deletions

View file

@ -1,6 +1,6 @@
{
"name": "paper-dropdown-menu",
"version": "1.0.1",
"version": "1.0.2",
"description": "An element that works similarly to a native browser select",
"authors": [
"The Polymer Authors"
@ -40,14 +40,13 @@
"web-component-tester": "*",
"paper-tabs": "polymerelements/paper-tabs#^1.0.0"
},
"_release": "1.0.1",
"_release": "1.0.2",
"_resolution": {
"type": "version",
"tag": "v1.0.1",
"commit": "c16e6087ce4b770938b96647e80c78765eea41fa"
"tag": "v1.0.2",
"commit": "fbf234c7bc8affe37e24c0b206d30551bc3289e5"
},
"_source": "git://github.com/PolymerElements/paper-dropdown-menu.git",
"_target": "~1.0.1",
"_originalSource": "PolymerElements/paper-dropdown-menu",
"_direct": true
"_originalSource": "PolymerElements/paper-dropdown-menu"
}

View file

@ -1,6 +1,6 @@
{
"name": "paper-dropdown-menu",
"version": "1.0.1",
"version": "1.0.2",
"description": "An element that works similarly to a native browser select",
"authors": [
"The Polymer Authors"

View file

@ -73,6 +73,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</div>
</div>
<div class="horizontal-section-container">
<div>
<h4>Pre-selected Value</h4>
<div class="horizontal-section">
<paper-dropdown-menu label="Dinosaurs">
<paper-menu class="dropdown-content" selected="1">
<template is="dom-repeat" items="[[dinosaurs]]" as="dinosaur">
<paper-item>[[dinosaur]]</paper-item>
</template>
</paper-menu>
</paper-dropdown-menu>
</div>
</div>
</div>
<div class="horizontal-section-container">
<div>
<h4>Disabled</h4>

View file

@ -27,7 +27,7 @@ item is displayed in the control. If no item is selected, the `label` is
displayed instead.
The child element with the class `dropdown-content` will be used as the dropdown
menu. It could be a `paper-menu` or element that triggers `iron-activate` when
menu. It could be a `paper-menu` or element that triggers `iron-select` when
selecting its children.
Example:
@ -130,7 +130,7 @@ respectively.
vertical-offset="[[_computeMenuVerticalOffset(noLabelFloat)]]"
disabled="[[disabled]]"
no-animations="[[noAnimations]]"
on-iron-activate="_onIronActivate"
on-iron-select="_onIronSelect"
opened="{{opened}}">
<div class="dropdown-trigger">
<paper-ripple></paper-ripple>
@ -145,9 +145,7 @@ respectively.
<iron-icon icon="arrow-drop-down" suffix></iron-icon>
</paper-input>
</div>
<div class="dropdown-content">
<content select=".dropdown-content"></content>
</div>
<content id="content" select=".dropdown-content"></content>
</paper-menu-button>
</template>
</dom-module>
@ -190,7 +188,7 @@ respectively.
/**
* The last selected item. An item is selected if the dropdown menu has
* a child with class `dropdown-content`, and that child triggers an
* `iron-activate` event with the selected `item` in the `detail`.
* `iron-select` event with the selected `item` in the `detail`.
*/
selectedItem: {
type: Object,
@ -264,6 +262,24 @@ respectively.
'aria-haspopup': 'true'
},
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
// still in a `DocumentFragment`. This has the effect of causing
// handlers not to fire. So, we double check this value on attached:
var contentElement = this.contentElement;
if (contentElement && contentElement.selectedItem) {
this._setSelectedItem(contentElement.selectedItem);
}
},
/**
* The content element that is contained by the dropdown menu, if any.
*/
get contentElement() {
return Polymer.dom(this.$.content).getDistributedNodes()[0];
},
/**
* Show the dropdown content.
*/
@ -279,11 +295,11 @@ respectively.
},
/**
* A handler that is called when `iron-activate` is fired.
* A handler that is called when `iron-select` is fired.
*
* @param {CustomEvent} event An `iron-activate` event.
* @param {CustomEvent} event An `iron-select` event.
*/
_onIronActivate: function(event) {
_onIronSelect: function(event) {
this._setSelectedItem(event.detail.item);
},

View file

@ -38,6 +38,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="PreselectedDropdownMenu">
<template>
<paper-dropdown-menu no-animations>
<paper-menu class="dropdown-content" selected="1">
<paper-item>Foo</paper-item>
<paper-item>Bar</paper-item>
</paper-menu>
</paper-dropdown-menu>
</template>
</test-fixture>
<script>
suite('<paper-dropdown-menu>', function() {
@ -97,6 +108,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
});
suite('when a value is preselected', function() {
setup(function() {
dropdownMenu = fixture('PreselectedDropdownMenu');
});
test('the input area shows the correct selection', function() {
var secondItem = Polymer.dom(dropdownMenu).querySelectorAll('paper-item')[1];
expect(dropdownMenu.selectedItem).to.be.equal(secondItem);
});
});
});
</script>