mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
b4d47994e6
commit
84e9dd4257
22 changed files with 516 additions and 375 deletions
|
@ -41,7 +41,7 @@
|
|||
"tag": "v1.1.3",
|
||||
"commit": "c13869b57a9464dfc3a1f26e89858f8be37e7441"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-icons.git",
|
||||
"_source": "git://github.com/polymerelements/iron-icons.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/iron-icons"
|
||||
"_originalSource": "polymerelements/iron-icons"
|
||||
}
|
|
@ -36,7 +36,7 @@
|
|||
"tag": "v1.3.0",
|
||||
"commit": "1662093611cda3fd29125cdab94a61d3d88093da"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-selector.git",
|
||||
"_source": "git://github.com/PolymerElements/iron-selector.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/iron-selector"
|
||||
"_originalSource": "PolymerElements/iron-selector"
|
||||
}
|
|
@ -12,12 +12,12 @@
|
|||
"library"
|
||||
],
|
||||
"homepage": "https://github.com/jquery/jquery-dist",
|
||||
"version": "2.2.2",
|
||||
"_release": "2.2.2",
|
||||
"version": "2.2.3",
|
||||
"_release": "2.2.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "2.2.2",
|
||||
"commit": "086d381cd2f3b4b8b0af85ecb2c9593a61e5b4bd"
|
||||
"tag": "2.2.3",
|
||||
"commit": "af22a351b2ea5801ffb1695abb3bb34d5bed9198"
|
||||
},
|
||||
"_source": "git://github.com/jquery/jquery-dist.git",
|
||||
"_target": ">=1.9.1",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* jQuery JavaScript Library v2.2.2
|
||||
* jQuery JavaScript Library v2.2.3
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
|
@ -9,7 +9,7 @@
|
|||
* Released under the MIT license
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Date: 2016-03-17T17:51Z
|
||||
* Date: 2016-04-05T19:26Z
|
||||
*/
|
||||
|
||||
(function( global, factory ) {
|
||||
|
@ -65,7 +65,7 @@ var support = {};
|
|||
|
||||
|
||||
var
|
||||
version = "2.2.2",
|
||||
version = "2.2.3",
|
||||
|
||||
// Define a local copy of jQuery
|
||||
jQuery = function( selector, context ) {
|
||||
|
@ -9475,7 +9475,7 @@ jQuery.fn.load = function( url, params, callback ) {
|
|||
// If it fails, this function gets "jqXHR", "status", "error"
|
||||
} ).always( callback && function( jqXHR, status ) {
|
||||
self.each( function() {
|
||||
callback.apply( self, response || [ jqXHR.responseText, status, jqXHR ] );
|
||||
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -72,7 +72,7 @@ jQuery.fn.load = function( url, params, callback ) {
|
|||
// If it fails, this function gets "jqXHR", "status", "error"
|
||||
} ).always( callback && function( jqXHR, status ) {
|
||||
self.each( function() {
|
||||
callback.apply( self, response || [ jqXHR.responseText, status, jqXHR ] );
|
||||
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
"tag": "v1.0.11",
|
||||
"commit": "e3c1ab0c72905b58fb4d9adc2921ea73b5c085a5"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/paper-behaviors.git",
|
||||
"_source": "git://github.com/PolymerElements/paper-behaviors.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "polymerelements/paper-behaviors"
|
||||
"_originalSource": "PolymerElements/paper-behaviors"
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-dialog-behavior",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"description": "Implements a behavior used for material design dialogs",
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
|
@ -30,15 +30,18 @@
|
|||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
|
||||
"paper-button": "PolymerElements/paper-button#^1.0.0",
|
||||
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0",
|
||||
"paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.0.0",
|
||||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-item": "PolymerElements/paper-item#^1.0.0",
|
||||
"paper-listbox": "PolymerElements/paper-listbox#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "1.2.4",
|
||||
"_release": "1.2.5",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.2.4",
|
||||
"commit": "d5988ae3790b285acc91f6d5708023f5223833f3"
|
||||
"tag": "v1.2.5",
|
||||
"commit": "4be4fa27fcff89500a6cb994e2359f92df0fa84e"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-dialog-behavior.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-dialog-behavior",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"description": "Implements a behavior used for material design dialogs",
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
|
@ -30,7 +30,10 @@
|
|||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
|
||||
"paper-button": "PolymerElements/paper-button#^1.0.0",
|
||||
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0",
|
||||
"paper-dropdown-menu": "PolymerElements/paper-dropdown-menu#^1.0.0",
|
||||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-item": "PolymerElements/paper-item#^1.0.0",
|
||||
"paper-listbox": "PolymerElements/paper-listbox#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<link rel="import" href="simple-dialog.html">
|
||||
|
||||
<link rel="import" href="../../paper-button/paper-button.html">
|
||||
<link rel="import" href="../../paper-dropdown-menu/paper-dropdown-menu.html">
|
||||
<link rel="import" href="../../paper-item/paper-item.html">
|
||||
<link rel="import" href="../../paper-listbox/paper-listbox.html">
|
||||
<link rel="import" href="../../paper-dialog-scrollable/paper-dialog-scrollable.html">
|
||||
<link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
|
||||
<link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
|
||||
|
@ -47,7 +50,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<paper-button raised onclick="modalAlert.toggle()">modal alert</paper-button>
|
||||
<simple-dialog id="modalAlert" modal role="alertdialog">
|
||||
<h2>Alert</h2>
|
||||
<p>Discard draft?</p>
|
||||
<paper-dropdown-menu label="Draft to discard">
|
||||
<paper-listbox class="dropdown-content">
|
||||
<paper-item>Draft 1</paper-item>
|
||||
<paper-item>Draft 2</paper-item>
|
||||
<paper-item>Draft 3</paper-item>
|
||||
<paper-item>Draft 4</paper-item>
|
||||
</paper-listbox>
|
||||
</paper-dropdown-menu>
|
||||
<div class="buttons">
|
||||
<paper-button onclick="modalDetails.toggle()">More details</paper-button>
|
||||
<paper-button dialog-dismiss>Cancel</paper-button>
|
||||
|
|
|
@ -11,7 +11,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
:host {
|
||||
display: block;
|
||||
margin: 24px 40px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
background: var(--paper-dialog-background-color, --primary-background-color);
|
||||
color: var(--paper-dialog-color, --primary-text-color);
|
||||
|
|
|
@ -14,7 +14,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
:host {
|
||||
display: block;
|
||||
margin: 24px 40px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
background: var(--paper-dialog-background-color, --primary-background-color);
|
||||
color: var(--paper-dialog-color, --primary-text-color);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-menu-button",
|
||||
"version": "1.0.4",
|
||||
"version": "1.1.0",
|
||||
"description": "A material design element that composes a trigger and a dropdown menu",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -16,39 +16,38 @@
|
|||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-menu-button"
|
||||
"url": "git://github.com/PolymerElements/paper-menu-button.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/paper-menu-button",
|
||||
"dependencies": {
|
||||
"polymer": "polymer/polymer#^1.0.0",
|
||||
"neon-animation": "polymerelements/neon-animation#^1.0.0",
|
||||
"paper-material": "polymerelements/paper-material#^1.0.0",
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.0",
|
||||
"iron-dropdown": "polymerelements/iron-dropdown#^1.0.0",
|
||||
"iron-a11y-keys-behavior": "polymerelements/iron-a11y-keys-behavior#^1.0.0",
|
||||
"iron-behaviors": "polymerelements/iron-behaviors#^1.0.0"
|
||||
"polymer": "Polymer/polymer#^1.1.0",
|
||||
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0",
|
||||
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
|
||||
"iron-dropdown": "PolymerElements/iron-dropdown#^1.0.0",
|
||||
"neon-animation": "PolymerElements/neon-animation#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
|
||||
"test-fixture": "polymerelements/test-fixture#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
|
||||
"web-component-tester": "*",
|
||||
"paper-menu": "polymerelements/paper-menu#^1.0.0",
|
||||
"paper-icon-button": "polymerelements/paper-icon-button#^1.0.0",
|
||||
"iron-icons": "polymerelements/iron-icons#^1.0.0",
|
||||
"paper-button": "polymerelements/paper-button#^1.0.0",
|
||||
"paper-item": "polymerelements/paper-item#^1.0.0",
|
||||
"iron-image": "polymerelements/iron-image#^1.0.0",
|
||||
"iron-icon": "polymerelements/iron-icon#^1.0.0"
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-icon": "PolymerElements/iron-icon#^1.0.0",
|
||||
"iron-icons": "PolymerElements/iron-icons#^1.0.0",
|
||||
"iron-image": "PolymerElements/iron-image#^1.0.0",
|
||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
|
||||
"paper-button": "PolymerElements/paper-button#^1.0.0",
|
||||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-item": "PolymerElements/paper-item#^1.0.0",
|
||||
"paper-menu": "PolymerElements/paper-menu#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"ignore": [],
|
||||
"_release": "1.0.4",
|
||||
"_release": "1.1.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "886c7eb904a5d59652adc0a127a8e0eab7e0f663"
|
||||
"tag": "v1.1.0",
|
||||
"commit": "7286bc656b9082e278e6e4ba43a518487ca189af"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/paper-menu-button.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
33
dashboard-ui/bower_components/paper-menu-button/.github/ISSUE_TEMPLATE.md
vendored
Normal file
33
dashboard-ui/bower_components/paper-menu-button/.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!-- Instructions: https://github.com/PolymerElements/paper-menu-button/CONTRIBUTING.md#filing-issues -->
|
||||
### Description
|
||||
<!-- Example: The `paper-foo` element causes the page to turn pink when clicked. -->
|
||||
|
||||
### Expected outcome
|
||||
|
||||
<!-- Example: The page stays the same color. -->
|
||||
|
||||
### Actual outcome
|
||||
|
||||
<!-- Example: The page turns pink. -->
|
||||
|
||||
### Live Demo
|
||||
<!-- Example: https://jsbin.com/cagaye/edit?html,output -->
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
<!-- Example
|
||||
1. Put a `paper-foo` element in the page.
|
||||
2. Open the page in a web browser.
|
||||
3. Click the `paper-foo` element.
|
||||
-->
|
||||
|
||||
### Browsers Affected
|
||||
<!-- Check all that apply -->
|
||||
- [ ] Chrome
|
||||
- [ ] Firefox
|
||||
- [ ] Safari 9
|
||||
- [ ] Safari 8
|
||||
- [ ] Safari 7
|
||||
- [ ] Edge
|
||||
- [ ] IE 11
|
||||
- [ ] IE 10
|
|
@ -1,22 +1,25 @@
|
|||
language: node_js
|
||||
sudo: false
|
||||
before_script:
|
||||
- npm install web-component-tester
|
||||
- npm install bower
|
||||
- 'export PATH=$PWD/node_modules/.bin:$PATH'
|
||||
- npm install -g bower polylint web-component-tester
|
||||
- bower install
|
||||
- polylint
|
||||
env:
|
||||
global:
|
||||
- secure: KylA/s+GkWGDpW9vcaBDrcr9M4xsE7HVyH36I5p7UBvQUiqPMFR/+GbFx7UoYR1OPNMf2hgHD4nd5G8hfnKjFuRl8NKe63Dnwt+83tKO9MKWrOAPq1/fMG/ZS1vRNP8Jqkp3iOsRUdatWsrs9LA5Pa6tM2OefQXs5ZF0F8s+de8Wv3+QwoGSjfJmTTC8j9tvrzEI6eOX66PAFGWUnySwV66tph+LRT/B/Y2HDcA0KbQucbyxCMnKU100xGJwK3+ZuPTEnqEqPv7R/9Z1Ggh+wXO/MduN+7OO6ZbF9//jrQNSY4QMKcz5zziYa0ugXH7F7HZijq3qxuLST0edPknozGi4xR7Vn00Zu8yHkIKYqswHrXM97qwoZZkBkwD8LEoZTkEIvk/uts68WVTiFaXV2FufBjl48E1BpjvMX1fW0hKTyFKXURXiJBphwNepyHFHpxSF29TKW1FBXy9ITiSMmKrdmqnnPliunDU44NK23tiuY90ZLKPLcOHBzLU7yzqVu67flbWxoWCCkP8gEkT6qRWHzRiZOiw0eHvXkmE1Gs+z1q/JuDg8Aaa40lm9oKC+dY8AfmQDhfXgfd89RbsF+AsJk7kp6wOVGCgmanrAeFSQcdU3qHB0ZQspS5kD1Y6mxl/R9a0iQnhtcHyLTadG8bfvc3EzP+2nYrP326Kir60=
|
||||
- secure: HBHAEcnTe6APHH/ZHmN4fd1sid/RCsgUsn7abA3hRxU6PM4Jo0C4nZhet60Q8joQyxiA415FSETvJVhdY7zHUcmxd0KklEAZjKX08v5vroAGJt0OUmxpZ/scoAcC09JfnZeVFO8Df/kx1WWP+q2LydrZhasPP8ifM+BBdD2wE/ShM6Jz7E5yQHgQ+pUf5yShfOzoYy0+tYtBpm9bxxj1i9qjPEfUiOxAWmSpefJ94dcIh2mCFpakBhPRh/l6FQip0+NPT00YEpk5/fDh+I2Apg8whWm02WiqGsXUpZZZaiGn8oAO5XckrKJGm0xuGYrI3cM1zRvsieaA424WwXNCSkXt6M8s0zQTqj+wlFQMOpEoIgD8dKW0gkIEt09ChKgmhs82FKE3OuI+Nz5z9DRRrtfoOckPi0bjVsOmXNDX0x569dpNOoJB21opfj6Nyl3Ln7/9q1J4LStt/VeuHzUUhBI33GTSlqW6qg0E0difa/bOc8dhSuXQ3Y8uunAXPk1Do7sWUhszF7k/wOjZ/oMsvvl8CiNZCJn0dbvrANOACNW8qBLoAlw2eHwA0wGTuN3VCZohYnHkeioYfkAFzPZX6QR4+NdpOorGBhxuOm0R7rR2q3SIrd+6Wd+T6A4+NLL8e+A57pc2lHKhtSwOOE7DdQpzrVyfN5NOaixlScqcbAw=
|
||||
node_js: 4
|
||||
- CXX=g++-4.8
|
||||
node_js: stable
|
||||
addons:
|
||||
firefox: latest
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- google-chrome-stable
|
||||
- g++-4.8
|
||||
sauce_connect: true
|
||||
script:
|
||||
- xvfb-run wct
|
||||
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
|
||||
|
|
|
@ -5,6 +5,11 @@ https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
|
|||
|
||||
If you edit that file, it will get updated everywhere else.
|
||||
If you edit this file, your changes will get overridden :)
|
||||
|
||||
You can however override the jsbin link with one that's customized to this
|
||||
specific element:
|
||||
|
||||
jsbin=https://jsbin.com/cagaye/edit?html,output
|
||||
-->
|
||||
# Polymer Elements
|
||||
## Guide for Contributors
|
||||
|
@ -41,7 +46,7 @@ Polymer Elements are built in the open, and the Polymer authors eagerly encourag
|
|||
3. Click the `paper-foo` element.
|
||||
```
|
||||
|
||||
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [http://jsbin.com/cagaye](http://jsbin.com/cagaye/edit?html,output).
|
||||
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
|
||||
|
||||
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
|
||||
|
||||
|
@ -51,14 +56,14 @@ Polymer Elements are built in the open, and the Polymer authors eagerly encourag
|
|||
|
||||
When submitting pull requests, please provide:
|
||||
|
||||
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues using the following syntax:
|
||||
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
|
||||
|
||||
```markdown
|
||||
(For a single issue)
|
||||
Fixes #20
|
||||
|
||||
(For multiple issues)
|
||||
Fixes #32, #40
|
||||
Fixes #32, fixes #40
|
||||
```
|
||||
|
||||
2. **A succinct description of the design** used to fix any related issues. For example:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "paper-menu-button",
|
||||
"version": "1.0.4",
|
||||
"version": "1.1.0",
|
||||
"description": "A material design element that composes a trigger and a dropdown menu",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -16,32 +16,31 @@
|
|||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-menu-button"
|
||||
"url": "git://github.com/PolymerElements/paper-menu-button.git"
|
||||
},
|
||||
"license": "MIT",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/paper-menu-button",
|
||||
"dependencies": {
|
||||
"polymer": "polymer/polymer#^1.0.0",
|
||||
"neon-animation": "polymerelements/neon-animation#^1.0.0",
|
||||
"paper-material": "polymerelements/paper-material#^1.0.0",
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.0",
|
||||
"iron-dropdown": "polymerelements/iron-dropdown#^1.0.0",
|
||||
"iron-a11y-keys-behavior": "polymerelements/iron-a11y-keys-behavior#^1.0.0",
|
||||
"iron-behaviors": "polymerelements/iron-behaviors#^1.0.0"
|
||||
"polymer": "Polymer/polymer#^1.1.0",
|
||||
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0",
|
||||
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
|
||||
"iron-dropdown": "PolymerElements/iron-dropdown#^1.0.0",
|
||||
"neon-animation": "PolymerElements/neon-animation#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
|
||||
"test-fixture": "polymerelements/test-fixture#^1.0.0",
|
||||
"iron-test-helpers": "polymerelements/iron-test-helpers#^1.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
|
||||
"web-component-tester": "*",
|
||||
"paper-menu": "polymerelements/paper-menu#^1.0.0",
|
||||
"paper-icon-button": "polymerelements/paper-icon-button#^1.0.0",
|
||||
"iron-icons": "polymerelements/iron-icons#^1.0.0",
|
||||
"paper-button": "polymerelements/paper-button#^1.0.0",
|
||||
"paper-item": "polymerelements/paper-item#^1.0.0",
|
||||
"iron-image": "polymerelements/iron-image#^1.0.0",
|
||||
"iron-icon": "polymerelements/iron-icon#^1.0.0"
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"iron-icon": "PolymerElements/iron-icon#^1.0.0",
|
||||
"iron-icons": "PolymerElements/iron-icons#^1.0.0",
|
||||
"iron-image": "PolymerElements/iron-image#^1.0.0",
|
||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0",
|
||||
"paper-button": "PolymerElements/paper-button#^1.0.0",
|
||||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-item": "PolymerElements/paper-item#^1.0.0",
|
||||
"paper-menu": "PolymerElements/paper-menu#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"ignore": []
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<link rel="import" href="../paper-menu-button.html">
|
||||
|
||||
<style>
|
||||
<style is="custom-style">
|
||||
paper-button {
|
||||
display: block;
|
||||
background: #4285f4;
|
||||
|
|
|
@ -9,13 +9,13 @@ 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-dropdown/iron-dropdown.html">
|
||||
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
||||
<link rel="import" href="../iron-behaviors/iron-control-state.html">
|
||||
<link rel="import" href="../paper-material/paper-material.html">
|
||||
<link rel="import" href="../paper-styles/default-theme.html">
|
||||
<link rel="import" href="../iron-dropdown/iron-dropdown.html">
|
||||
<link rel="import" href="../neon-animation/animations/fade-in-animation.html">
|
||||
<link rel="import" href="../neon-animation/animations/fade-out-animation.html">
|
||||
<link rel="import" href="../paper-styles/default-theme.html">
|
||||
<link rel="import" href="../paper-styles/shadow.html">
|
||||
<link rel="import" href="paper-menu-button-animations.html">
|
||||
|
||||
<!--
|
||||
|
@ -50,7 +50,7 @@ The following custom properties and mixins are also available for styling:
|
|||
|
||||
Custom property | Description | Default
|
||||
----------------|-------------|----------
|
||||
`--paper-menu-button-dropdown-background` | Background color of the paper-menu-button dropdown | `#fff`
|
||||
`--paper-menu-button-dropdown-background` | Background color of the paper-menu-button dropdown | `--primary-background-color`
|
||||
`--paper-menu-button` | Mixin applied to the paper-menu-button | `{}`
|
||||
`--paper-menu-button-disabled` | Mixin applied to the paper-menu-button when disabled | `{}`
|
||||
`--paper-menu-button-dropdown` | Mixin applied to the paper-menu-button dropdown | `{}`
|
||||
|
@ -61,49 +61,55 @@ Custom property | Description | Default
|
|||
-->
|
||||
|
||||
<dom-module id="paper-menu-button">
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding: 8px;
|
||||
outline: none;
|
||||
|
||||
@apply(--paper-menu-button);
|
||||
}
|
||||
|
||||
:host([disabled]) {
|
||||
cursor: auto;
|
||||
color: var(--disabled-text-color);
|
||||
|
||||
@apply(--paper-menu-button-disabled);
|
||||
}
|
||||
|
||||
:host([vertical-align="top"]) paper-material {
|
||||
margin-bottom: 20px;
|
||||
margin-top: -10px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
:host([vertical-align="bottom"]) paper-material {
|
||||
bottom: 10px;
|
||||
margin-bottom: -10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
iron-dropdown {
|
||||
@apply(--paper-menu-button-dropdown);
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
border-radius: 2px;
|
||||
background-color: var(--paper-menu-button-dropdown-background, --primary-background-color);
|
||||
@apply(--paper-menu-button-content);
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div id="trigger" on-tap="open">
|
||||
<style>
|
||||
:host {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
padding: 8px;
|
||||
outline: none;
|
||||
|
||||
@apply(--paper-menu-button);
|
||||
}
|
||||
|
||||
:host([disabled]) {
|
||||
cursor: auto;
|
||||
color: var(--disabled-text-color);
|
||||
|
||||
@apply(--paper-menu-button-disabled);
|
||||
}
|
||||
|
||||
iron-dropdown {
|
||||
@apply(--paper-menu-button-dropdown);
|
||||
}
|
||||
|
||||
.dropdown-content {
|
||||
@apply(--shadow-elevation-2dp);
|
||||
|
||||
position: relative;
|
||||
border-radius: 2px;
|
||||
background-color: var(--paper-menu-button-dropdown-background, --primary-background-color);
|
||||
|
||||
@apply(--paper-menu-button-content);
|
||||
}
|
||||
|
||||
:host([vertical-align="top"]) .dropdown-content {
|
||||
margin-bottom: 20px;
|
||||
margin-top: -10px;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
:host([vertical-align="bottom"]) .dropdown-content {
|
||||
bottom: 10px;
|
||||
margin-bottom: -10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="trigger" on-tap="toggle">
|
||||
<content select=".dropdown-trigger"></content>
|
||||
</div>
|
||||
|
||||
<iron-dropdown
|
||||
id="dropdown"
|
||||
opened="{{opened}}"
|
||||
|
@ -114,264 +120,287 @@ Custom property | Description | Default
|
|||
open-animation-config="[[openAnimationConfig]]"
|
||||
close-animation-config="[[closeAnimationConfig]]"
|
||||
no-animations="[[noAnimations]]"
|
||||
focus-target="[[_dropdownContent]]">
|
||||
<paper-material class="dropdown-content">
|
||||
focus-target="[[_dropdownContent]]"
|
||||
on-iron-overlay-canceled="__onIronOverlayCanceled">
|
||||
<div class="dropdown-content">
|
||||
<content id="content" select=".dropdown-content"></content>
|
||||
</paper-material>
|
||||
</div>
|
||||
</iron-dropdown>
|
||||
</template>
|
||||
</dom-module>
|
||||
<script>
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var PaperMenuButton = Polymer({
|
||||
is: 'paper-menu-button',
|
||||
<script>
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Fired when the dropdown opens.
|
||||
*
|
||||
* @event paper-dropdown-open
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the dropdown closes.
|
||||
*
|
||||
* @event paper-dropdown-close
|
||||
*/
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronA11yKeysBehavior,
|
||||
Polymer.IronControlState
|
||||
],
|
||||
|
||||
properties: {
|
||||
var PaperMenuButton = Polymer({
|
||||
is: 'paper-menu-button',
|
||||
|
||||
/**
|
||||
* True if the content is currently displayed.
|
||||
* Fired when the dropdown opens.
|
||||
*
|
||||
* @event paper-dropdown-open
|
||||
*/
|
||||
opened: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true,
|
||||
observer: '_openedChanged'
|
||||
|
||||
/**
|
||||
* Fired when the dropdown closes.
|
||||
*
|
||||
* @event paper-dropdown-close
|
||||
*/
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronA11yKeysBehavior,
|
||||
Polymer.IronControlState
|
||||
],
|
||||
|
||||
properties: {
|
||||
/**
|
||||
* True if the content is currently displayed.
|
||||
*/
|
||||
opened: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
notify: true,
|
||||
observer: '_openedChanged'
|
||||
},
|
||||
|
||||
/**
|
||||
* The orientation against which to align the menu dropdown
|
||||
* horizontally relative to the dropdown trigger.
|
||||
*/
|
||||
horizontalAlign: {
|
||||
type: String,
|
||||
value: 'left',
|
||||
reflectToAttribute: true
|
||||
},
|
||||
|
||||
/**
|
||||
* The orientation against which to align the menu dropdown
|
||||
* vertically relative to the dropdown trigger.
|
||||
*/
|
||||
verticalAlign: {
|
||||
type: String,
|
||||
value: 'top',
|
||||
reflectToAttribute: true
|
||||
},
|
||||
|
||||
/**
|
||||
* A pixel value that will be added to the position calculated for the
|
||||
* given `horizontalAlign`. Use a negative value to offset to the
|
||||
* left, or a positive value to offset to the right.
|
||||
*/
|
||||
horizontalOffset: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true
|
||||
},
|
||||
|
||||
/**
|
||||
* A pixel value that will be added to the position calculated for the
|
||||
* given `verticalAlign`. Use a negative value to offset towards the
|
||||
* top, or a positive value to offset towards the bottom.
|
||||
*/
|
||||
verticalOffset: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true
|
||||
},
|
||||
|
||||
/**
|
||||
* Set to true to disable animations when opening and closing the
|
||||
* dropdown.
|
||||
*/
|
||||
noAnimations: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Set to true to disable automatically closing the dropdown after
|
||||
* a selection has been made.
|
||||
*/
|
||||
ignoreSelect: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* An animation config. If provided, this will be used to animate the
|
||||
* opening of the dropdown.
|
||||
*/
|
||||
openAnimationConfig: {
|
||||
type: Object,
|
||||
value: function() {
|
||||
return [{
|
||||
name: 'fade-in-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 200
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-grow-width-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 150,
|
||||
easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-grow-height-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 275,
|
||||
easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
|
||||
}
|
||||
}];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* An animation config. If provided, this will be used to animate the
|
||||
* closing of the dropdown.
|
||||
*/
|
||||
closeAnimationConfig: {
|
||||
type: Object,
|
||||
value: function() {
|
||||
return [{
|
||||
name: 'fade-out-animation',
|
||||
timing: {
|
||||
duration: 150
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-shrink-width-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 50,
|
||||
easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-shrink-height-animation',
|
||||
timing: {
|
||||
duration: 200,
|
||||
easing: 'ease-in'
|
||||
}
|
||||
}];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This is the element intended to be bound as the focus target
|
||||
* for the `iron-dropdown` contained by `paper-menu-button`.
|
||||
*/
|
||||
_dropdownContent: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
|
||||
hostAttributes: {
|
||||
role: 'group',
|
||||
'aria-haspopup': 'true'
|
||||
},
|
||||
|
||||
listeners: {
|
||||
'iron-select': '_onIronSelect'
|
||||
},
|
||||
|
||||
/**
|
||||
* The orientation against which to align the menu dropdown
|
||||
* horizontally relative to the dropdown trigger.
|
||||
* The content element that is contained by the menu button, if any.
|
||||
*/
|
||||
horizontalAlign: {
|
||||
type: String,
|
||||
value: 'left',
|
||||
reflectToAttribute: true
|
||||
get contentElement() {
|
||||
return Polymer.dom(this.$.content).getDistributedNodes()[0];
|
||||
},
|
||||
|
||||
/**
|
||||
* The orientation against which to align the menu dropdown
|
||||
* vertically relative to the dropdown trigger.
|
||||
* Toggles the drowpdown content between opened and closed.
|
||||
*/
|
||||
verticalAlign: {
|
||||
type: String,
|
||||
value: 'top',
|
||||
reflectToAttribute: true
|
||||
toggle: function() {
|
||||
if (this.opened) {
|
||||
this.close();
|
||||
} else {
|
||||
this.open();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* A pixel value that will be added to the position calculated for the
|
||||
* given `horizontalAlign`. Use a negative value to offset to the
|
||||
* left, or a positive value to offset to the right.
|
||||
* Make the dropdown content appear as an overlay positioned relative
|
||||
* to the dropdown trigger.
|
||||
*/
|
||||
horizontalOffset: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true
|
||||
open: function() {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$.dropdown.open();
|
||||
},
|
||||
|
||||
/**
|
||||
* A pixel value that will be added to the position calculated for the
|
||||
* given `verticalAlign`. Use a negative value to offset towards the
|
||||
* top, or a positive value to offset towards the bottom.
|
||||
* Hide the dropdown content.
|
||||
*/
|
||||
verticalOffset: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
notify: true
|
||||
close: function() {
|
||||
this.$.dropdown.close();
|
||||
},
|
||||
|
||||
/**
|
||||
* Set to true to disable animations when opening and closing the
|
||||
* When an `iron-select` event is received, the dropdown should
|
||||
* automatically close on the assumption that a value has been chosen.
|
||||
*
|
||||
* @param {CustomEvent} event A CustomEvent instance with type
|
||||
* set to `"iron-select"`.
|
||||
*/
|
||||
_onIronSelect: function(event) {
|
||||
if (!this.ignoreSelect) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* When the dropdown opens, the `paper-menu-button` fires `paper-open`.
|
||||
* When the dropdown closes, the `paper-menu-button` fires `paper-close`.
|
||||
*
|
||||
* @param {boolean} opened True if the dropdown is opened, otherwise false.
|
||||
* @param {boolean} oldOpened The previous value of `opened`.
|
||||
*/
|
||||
_openedChanged: function(opened, oldOpened) {
|
||||
if (opened) {
|
||||
// TODO(cdata): Update this when we can measure changes in distributed
|
||||
// children in an idiomatic way.
|
||||
// We poke this property in case the element has changed. This will
|
||||
// cause the focus target for the `iron-dropdown` to be updated as
|
||||
// necessary:
|
||||
this._dropdownContent = this.contentElement;
|
||||
this.fire('paper-dropdown-open');
|
||||
} else if (oldOpened != null) {
|
||||
this.fire('paper-dropdown-close');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* If the dropdown is open when disabled becomes true, close the
|
||||
* dropdown.
|
||||
*
|
||||
* @param {boolean} disabled True if disabled, otherwise false.
|
||||
*/
|
||||
noAnimations: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* Set to true to disable automatically closing the dropdown after
|
||||
* a selection has been made.
|
||||
*/
|
||||
ignoreSelect: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* An animation config. If provided, this will be used to animate the
|
||||
* opening of the dropdown.
|
||||
*/
|
||||
openAnimationConfig: {
|
||||
type: Object,
|
||||
value: function() {
|
||||
return [{
|
||||
name: 'fade-in-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 200
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-grow-width-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 150,
|
||||
easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-grow-height-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 275,
|
||||
easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
|
||||
}
|
||||
}];
|
||||
_disabledChanged: function(disabled) {
|
||||
Polymer.IronControlState._disabledChanged.apply(this, arguments);
|
||||
if (disabled && this.opened) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* An animation config. If provided, this will be used to animate the
|
||||
* closing of the dropdown.
|
||||
*/
|
||||
closeAnimationConfig: {
|
||||
type: Object,
|
||||
value: function() {
|
||||
return [{
|
||||
name: 'fade-out-animation',
|
||||
timing: {
|
||||
duration: 150
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-shrink-width-animation',
|
||||
timing: {
|
||||
delay: 100,
|
||||
duration: 50,
|
||||
easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
|
||||
}
|
||||
}, {
|
||||
name: 'paper-menu-shrink-height-animation',
|
||||
timing: {
|
||||
duration: 200,
|
||||
easing: 'ease-in'
|
||||
}
|
||||
}];
|
||||
__onIronOverlayCanceled: function(event) {
|
||||
var uiEvent = event.detail;
|
||||
var target = Polymer.dom(uiEvent).rootTarget;
|
||||
var trigger = this.$.trigger;
|
||||
var path = Polymer.dom(uiEvent).path;
|
||||
|
||||
if (path.indexOf(trigger) > -1) {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This is the element intended to be bound as the focus target
|
||||
* for the `iron-dropdown` contained by `paper-menu-button`.
|
||||
*/
|
||||
_dropdownContent: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
hostAttributes: {
|
||||
role: 'group',
|
||||
'aria-haspopup': 'true'
|
||||
},
|
||||
PaperMenuButton.ANIMATION_CUBIC_BEZIER = 'cubic-bezier(.3,.95,.5,1)';
|
||||
PaperMenuButton.MAX_ANIMATION_TIME_MS = 400;
|
||||
|
||||
listeners: {
|
||||
'iron-select': '_onIronSelect'
|
||||
},
|
||||
|
||||
/**
|
||||
* The content element that is contained by the menu button, if any.
|
||||
*/
|
||||
get contentElement() {
|
||||
return Polymer.dom(this.$.content).getDistributedNodes()[0];
|
||||
},
|
||||
|
||||
/**
|
||||
* Make the dropdown content appear as an overlay positioned relative
|
||||
* to the dropdown trigger.
|
||||
*/
|
||||
open: function() {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$.dropdown.open();
|
||||
},
|
||||
|
||||
/**
|
||||
* Hide the dropdown content.
|
||||
*/
|
||||
close: function() {
|
||||
this.$.dropdown.close();
|
||||
},
|
||||
|
||||
/**
|
||||
* When an `iron-select` event is received, the dropdown should
|
||||
* automatically close on the assumption that a value has been chosen.
|
||||
*
|
||||
* @param {CustomEvent} event A CustomEvent instance with type
|
||||
* set to `"iron-select"`.
|
||||
*/
|
||||
_onIronSelect: function(event) {
|
||||
if (!this.ignoreSelect) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* When the dropdown opens, the `paper-menu-button` fires `paper-open`.
|
||||
* When the dropdown closes, the `paper-menu-button` fires `paper-close`.
|
||||
*
|
||||
* @param {boolean} opened True if the dropdown is opened, otherwise false.
|
||||
* @param {boolean} oldOpened The previous value of `opened`.
|
||||
*/
|
||||
_openedChanged: function(opened, oldOpened) {
|
||||
if (opened) {
|
||||
// TODO(cdata): Update this when we can measure changes in distributed
|
||||
// children in an idiomatic way.
|
||||
// We poke this property in case the element has changed. This will
|
||||
// cause the focus target for the `iron-dropdown` to be updated as
|
||||
// necessary:
|
||||
this._dropdownContent = this.contentElement;
|
||||
this.fire('paper-dropdown-open');
|
||||
} else if (oldOpened != null) {
|
||||
this.fire('paper-dropdown-close');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* If the dropdown is open when disabled becomes true, close the
|
||||
* dropdown.
|
||||
*
|
||||
* @param {boolean} disabled True if disabled, otherwise false.
|
||||
*/
|
||||
_disabledChanged: function(disabled) {
|
||||
Polymer.IronControlState._disabledChanged.apply(this, arguments);
|
||||
if (disabled && this.opened) {
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
PaperMenuButton.ANIMATION_CUBIC_BEZIER = 'cubic-bezier(.3,.95,.5,1)';
|
||||
PaperMenuButton.MAX_ANIMATION_TIME_MS = 400;
|
||||
|
||||
Polymer.PaperMenuButton = PaperMenuButton;
|
||||
})();
|
||||
</script>
|
||||
Polymer.PaperMenuButton = PaperMenuButton;
|
||||
})();
|
||||
</script>
|
||||
</dom-module>
|
||||
|
|
|
@ -34,6 +34,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="TwoMenuButtons">
|
||||
<template>
|
||||
<paper-menu-button no-animations>
|
||||
<span class="dropdown-trigger">trigger</span>
|
||||
<span class="dropdown-content">content</span>
|
||||
</paper-menu-button>
|
||||
<paper-menu-button no-animations>
|
||||
<span class="dropdown-trigger">trigger</span>
|
||||
<span class="dropdown-content">content</span>
|
||||
</paper-menu-button>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('<paper-menu-button>', function() {
|
||||
var menuButton;
|
||||
|
@ -54,37 +67,27 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
expect(contentRect.width).to.be.equal(0);
|
||||
expect(contentRect.height).to.be.equal(0);
|
||||
|
||||
MockInteractions.tap(trigger);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
contentRect = content.getBoundingClientRect();
|
||||
|
||||
menuButton.addEventListener('paper-dropdown-open', function() {
|
||||
expect(menuButton.opened).to.be.equal(true);
|
||||
|
||||
expect(contentRect.width).to.be.greaterThan(0);
|
||||
expect(contentRect.height).to.be.greaterThan(0);
|
||||
done();
|
||||
});
|
||||
|
||||
MockInteractions.tap(trigger);
|
||||
});
|
||||
|
||||
test('closes when trigger is clicked again', function(done) {
|
||||
MockInteractions.tap(trigger);
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
|
||||
MockInteractions.tap(trigger);
|
||||
menuButton.addEventListener('paper-dropdown-open', function() {
|
||||
menuButton.addEventListener('paper-dropdown-close', function() {
|
||||
expect(menuButton.opened).to.be.equal(false);
|
||||
done();
|
||||
});
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
var contentRect = content.getBoundingClientRect();
|
||||
|
||||
expect(menuButton.opened).to.be.equal(false);
|
||||
|
||||
expect(contentRect.width).to.be.equal(0);
|
||||
expect(contentRect.height).to.be.equal(0);
|
||||
|
||||
done();
|
||||
}, Polymer.PaperMenuButton.MAX_ANIMATION_TIME_MS);
|
||||
}, 100);
|
||||
MockInteractions.tap(trigger);
|
||||
});
|
||||
});
|
||||
|
||||
MockInteractions.tap(trigger);
|
||||
});
|
||||
|
||||
test('closes when disabled while open', function() {
|
||||
|
@ -103,6 +106,62 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
test('has aria-haspopup attribute', function() {
|
||||
expect(menuButton.hasAttribute('aria-haspopup')).to.be.equal(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
suite('when there are two buttons', function() {
|
||||
var menuButton;
|
||||
var trigger;
|
||||
var otherButton;
|
||||
var otherTrigger;
|
||||
|
||||
setup(function() {
|
||||
var buttons = fixture('TwoMenuButtons');
|
||||
menuButton = buttons[0];
|
||||
otherButton = buttons[1];
|
||||
trigger = Polymer.dom(menuButton).querySelector('.dropdown-trigger');
|
||||
otherTrigger = Polymer.dom(otherButton).querySelector('.dropdown-trigger');
|
||||
});
|
||||
|
||||
test('closes current and opens other', function(done) {
|
||||
expect(menuButton.opened).to.be.equal(false);
|
||||
expect(otherButton.opened).to.be.equal(false);
|
||||
|
||||
/*
|
||||
NOTE: iron-overlay-behavior adds listeners asynchronously when the
|
||||
overlay opens, so we need to wait for this event which is a
|
||||
more-explicit signal that tells us that the overlay is really opened.
|
||||
*/
|
||||
menuButton.addEventListener('iron-overlay-opened', function() {
|
||||
expect(menuButton.opened).to.be.equal(true);
|
||||
expect(otherButton.opened).to.be.equal(false);
|
||||
|
||||
var firstClosed = false;
|
||||
var secondOpened = false;
|
||||
|
||||
menuButton.addEventListener('paper-dropdown-close', function() {
|
||||
firstClosed = true;
|
||||
});
|
||||
|
||||
otherButton.addEventListener('paper-dropdown-open', function() {
|
||||
secondOpened = true;
|
||||
});
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
MockInteractions.tap(otherTrigger);
|
||||
});
|
||||
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
expect(firstClosed).to.be.equal(true);
|
||||
expect(secondOpened).to.be.equal(true);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
MockInteractions.tap(trigger);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
@ -34,6 +34,6 @@
|
|||
"commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/polymer.git",
|
||||
"_target": "^1.1.0",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "Polymer/polymer"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue