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

update translations

This commit is contained in:
Luke Pulverenti 2015-08-12 17:39:02 -04:00
parent d65219f9f8
commit dbf135beac
114 changed files with 3331 additions and 93 deletions

View file

@ -0,0 +1,53 @@
{
"name": "paper-menu-button",
"version": "1.0.2",
"description": "",
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"web-component",
"polymer"
],
"main": "paper-menu-button.html",
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/paper-menu-button"
},
"license": "MIT",
"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"
},
"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"
},
"_release": "1.0.2",
"_resolution": {
"type": "version",
"tag": "v1.0.2",
"commit": "cf8bdea832bfa7b4f413e021ecb328273d659b17"
},
"_source": "git://github.com/polymerelements/paper-menu-button.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/paper-menu-button"
}

View file

@ -0,0 +1 @@
bower_components

View file

@ -0,0 +1,44 @@
{
"name": "paper-menu-button",
"version": "1.0.2",
"description": "",
"authors": [
"The Polymer Authors"
],
"keywords": [
"web-components",
"web-component",
"polymer"
],
"main": "paper-menu-button.html",
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/paper-menu-button"
},
"license": "MIT",
"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"
},
"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"
}
}

View file

@ -0,0 +1,203 @@
<!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>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>paper-menu-button</title>
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../../iron-icons/iron-icons.html">
<link rel="import" href="../../iron-icon/iron-icon.html">
<link rel="import" href="../../iron-image/iron-image.html">
<link rel="import" href="../../paper-menu/paper-menu.html">
<link rel="import" href="../../paper-item/paper-item.html">
<link rel="import" href="../../paper-button/paper-button.html">
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../paper-menu-button.html">
<style>
paper-button {
display: block;
background: #4285f4;
color: #fff;
}
paper-menu {
display: block;
}
paper-menu-button {
margin: auto;
}
iron-image {
padding: 1em;
}
.item {
max-width: 300px;
}
.horizontal-section {
text-align: center;
}
</style>
</head>
<body unresolved>
<template id="Demo" is="dom-bind">
<div class="horizontal-section-container">
<div>
<h4>Paper Icon Button + Paper Menu</h4>
<div class="horizontal-section">
<paper-menu-button>
<paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
<paper-menu class="dropdown-content">
<template is="dom-repeat" items="[[letters]]" as="letter">
<paper-item>[[letter]]</paper-item>
</template>
</paper-menu>
</paper-menu-button>
</div>
</div>
</div>
<div class="horizontal-section-container">
<div>
<h4>Paper Menu with multi selection</h4>
<div class="horizontal-section">
<paper-menu-button ignore-activate>
<paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
<paper-menu class="dropdown-content" multi>
<template is="dom-repeat" items="[[letters]]" as="letter">
<paper-item>[[letter]]</paper-item>
</template>
</paper-menu>
</paper-menu-button>
</div>
</div>
</div>
<div class="horizontal-section-container">
<div>
<h4>Disabled</h4>
<div class="horizontal-section">
<paper-menu-button disabled>
<paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
<paper-menu class="dropdown-content">
<template is="dom-repeat" items="[[letters]]" as="letter">
<paper-item>[[letter]]</paper-item>
</template>
</paper-menu>
</paper-menu-button>
</div>
</div>
</div>
<div class="horizontal-section-container">
<div>
<h4>Alternate Alignment</h4>
<div class="horizontal-section">
<paper-menu-button vertical-align="bottom" horizontal-align="right">
<paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
<paper-menu class="dropdown-content">
<template is="dom-repeat" items="[[letters]]" as="letter">
<paper-item>[[letter]]</paper-item>
</template>
</paper-menu>
</paper-menu-button>
</div>
</div>
</div>
<div class="horizontal-section-container">
<div>
<h4>Alternate Button</h4>
<div class="horizontal-section">
<paper-menu-button>
<paper-button class="dropdown-trigger" raised>
<iron-icon icon="check"></iron-icon>
<span>Dinosaurs</span>
</paper-button>
<paper-menu class="dropdown-content">
<template is="dom-repeat" items="[[dinosaurs]]" as="dinosaur">
<paper-item>[[dinosaur]]</paper-item>
</template>
</paper-menu>
</paper-menu-button>
</div>
</div>
</div>
<div class="horizontal-section-container">
<div>
<h4>Alternate Content</h4>
<div class="horizontal-section">
<paper-menu-button vertical-align="bottom">
<paper-icon-button class="dropdown-trigger" icon="polymer"></paper-icon-button>
<iron-image class="dropdown-content" src="../../iron-image/demo/polymer.svg"></iron-image>
</paper-menu-button>
</div>
</div>
</div>
</template>
<script>
Demo.letters = [
'alpha',
'beta',
'gamma',
'delta',
'epsilon'
];
Demo.dinosaurs = [
'allosaurus',
'brontosaurus',
'carcharodontosaurus',
'diplodocus',
'ekrixinatosaurus',
'fukuiraptor',
'gallimimus',
'hadrosaurus',
'iguanodon',
'jainosaurus',
'kritosaurus',
'liaoceratops',
'megalosaurus',
'nemegtosaurus',
'ornithomimus',
'protoceratops',
'quetecsaurus',
'rajasaurus',
'stegosaurus',
'triceratops',
'utahraptor',
'vulcanodon',
'wannanosaurus',
'xenoceratops',
'yandusaurus',
'zephyrosaurus'
];
</script>
</body>
</html>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
<g id="background" display="none">
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
</g>
<g id="label">
</g>
<g id="art">
<circle cx="109" cy="45" r="4"/>
<path d="M165,50c-2.8,0-4.1-2.4-5.3-4.5c-1.2-2.2-2-3.5-3.5-3.5c-1.5,0-2.3,1.3-3.5,3.5c-1.2,2.1-2.5,4.5-5.3,4.5
c-2.8,0-4.1-2.4-5.3-4.5c-1.2-2.2-2-3.5-3.5-3.5c-1.5,0-2.3,1.3-3.5,3.5c-1.2,2.1-2.5,4.5-5.3,4.5c-2.8,0-4.1-2.4-5.3-4.5
c-1.2-2.2-2-3.5-3.5-3.5v-2c2.8,0,4.1,2.4,5.3,4.5c1.2,2.2,2,3.5,3.5,3.5c1.5,0,2.3-1.3,3.5-3.5c1.2-2.1,2.5-4.5,5.3-4.5
c2.8,0,4.1,2.4,5.3,4.5c1.2,2.2,2,3.5,3.5,3.5c1.5,0,2.3-1.3,3.5-3.5c1.2-2.1,2.5-4.5,5.3-4.5s4.1,2.4,5.3,4.5
c1.2,2.2,2,3.5,3.5,3.5V50z"/>
<circle cx="109" cy="63" r="4"/>
<path d="M165,68c-2.8,0-4.1-2.4-5.3-4.5c-1.2-2.2-2-3.5-3.5-3.5c-1.5,0-2.3,1.3-3.5,3.5c-1.2,2.1-2.5,4.5-5.3,4.5
c-2.8,0-4.1-2.4-5.3-4.5c-1.2-2.2-2-3.5-3.5-3.5c-1.5,0-2.3,1.3-3.5,3.5c-1.2,2.1-2.5,4.5-5.3,4.5c-2.8,0-4.1-2.4-5.3-4.5
c-1.2-2.2-2-3.5-3.5-3.5v-2c2.8,0,4.1,2.4,5.3,4.5c1.2,2.2,2,3.5,3.5,3.5c1.5,0,2.3-1.3,3.5-3.5c1.2-2.1,2.5-4.5,5.3-4.5
c2.8,0,4.1,2.4,5.3,4.5c1.2,2.2,2,3.5,3.5,3.5c1.5,0,2.3-1.3,3.5-3.5c1.2-2.1,2.5-4.5,5.3-4.5s4.1,2.4,5.3,4.5
c1.2,2.2,2,3.5,3.5,3.5V68z"/>
<circle cx="109" cy="81" r="4"/>
<path d="M165,86c-2.8,0-4.1-2.4-5.3-4.5c-1.2-2.2-2-3.5-3.5-3.5c-1.5,0-2.3,1.3-3.5,3.5c-1.2,2.1-2.5,4.5-5.3,4.5
c-2.8,0-4.1-2.4-5.3-4.5c-1.2-2.2-2-3.5-3.5-3.5c-1.5,0-2.3,1.3-3.5,3.5c-1.2,2.1-2.5,4.5-5.3,4.5c-2.8,0-4.1-2.4-5.3-4.5
c-1.2-2.2-2-3.5-3.5-3.5v-2c2.8,0,4.1,2.4,5.3,4.5c1.2,2.2,2,3.5,3.5,3.5c1.5,0,2.3-1.3,3.5-3.5c1.2-2.1,2.5-4.5,5.3-4.5
c2.8,0,4.1,2.4,5.3,4.5c1.2,2.2,2,3.5,3.5,3.5c1.5,0,2.3-1.3,3.5-3.5c1.2-2.1,2.5-4.5,5.3-4.5s4.1,2.4,5.3,4.5
c1.2,2.2,2,3.5,3.5,3.5V86z"/>
<path d="M176,98H94V28h82V98z M96,96h78V30H96V96z"/>
<circle cx="65" cy="61" r="8"/>
<path d="M82,78H48V44h34V78z M50,76h30V46H50V76z"/>
<rect x="81" y="58" width="14" height="2"/>
<g id="ic_x5F_add_x0D_">
</g>
</g>
<g id="Guides">
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -0,0 +1,24 @@
<!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
The complete set of authors may be found at http://polymer.github.io/AUTHORS
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
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
-->
<html>
<head>
<title>paper-menu-button</title>
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="../iron-component-page/iron-component-page.html">
</head>
<body>
<iron-component-page></iron-component-page>
</body>
</html>

View file

@ -0,0 +1,109 @@
<!--
@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="../neon-animation/web-animations.html">
<link rel="import" href="../neon-animation/neon-animation-behavior.html">
<script>
Polymer({
is: 'paper-menu-grow-height-animation',
behaviors: [
Polymer.NeonAnimationBehavior
],
configure: function(config) {
var node = config.node;
var rect = node.getBoundingClientRect();
var height = rect.height;
this._effect = new KeyframeEffect(node, [{
height: (height / 2) + 'px'
}, {
height: height + 'px'
}], this.timingFromConfig(config));
return this._effect;
}
});
Polymer({
is: 'paper-menu-grow-width-animation',
behaviors: [
Polymer.NeonAnimationBehavior
],
configure: function(config) {
var node = config.node;
var rect = node.getBoundingClientRect();
var width = rect.width;
this._effect = new KeyframeEffect(node, [{
width: (width / 2) + 'px'
}, {
width: width + 'px'
}], this.timingFromConfig(config));
return this._effect;
}
});
Polymer({
is: 'paper-menu-shrink-width-animation',
behaviors: [
Polymer.NeonAnimationBehavior
],
configure: function(config) {
var node = config.node;
var rect = node.getBoundingClientRect();
var width = rect.width;
this._effect = new KeyframeEffect(node, [{
width: width + 'px'
}, {
width: width - (width / 20) + 'px'
}], this.timingFromConfig(config));
return this._effect;
}
});
Polymer({
is: 'paper-menu-shrink-height-animation',
behaviors: [
Polymer.NeonAnimationBehavior
],
configure: function(config) {
var node = config.node;
var rect = node.getBoundingClientRect();
var height = rect.height;
var top = rect.top;
this.setPrefixedProperty(node, 'transformOrigin', '0 0');
this._effect = new KeyframeEffect(node, [{
height: height + 'px',
transform: 'translateY(0)'
}, {
height: height / 2 + 'px',
transform: 'translateY(-20px)'
}], this.timingFromConfig(config));
return this._effect;
}
});
</script>

View file

@ -0,0 +1,349 @@
<!--
@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-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="../neon-animation/animations/fade-in-animation.html">
<link rel="import" href="../neon-animation/animations/fade-out-animation.html">
<link rel="import" href="paper-menu-button-animations.html">
<!--
`paper-menu-button` allows one to compose a designated "trigger" element with
another element that represents "content", to create a dropdown menu that
displays the "content" when the "trigger" is clicked.
The child element with the class `dropdown-trigger` will be used as the
"trigger" element. The child element with the class `dropdown-content` will be
used as the "content" element.
The `paper-menu-button` is sensitive to its content's `iron-select` events. If
the "content" element triggers an `iron-select` event, the `paper-menu-button`
will close automatically.
Example:
<paper-menu-button>
<paper-icon-button icon="menu" class="dropdown-trigger"></paper-icon-button>
<paper-menu class="dropdown-content">
<paper-item>Share</paper-item>
<paper-item>Settings</paper-item>
<paper-item>Help</paper-item>
</paper-menu>
</paper-menu-button>
### Styling
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` | 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 | `{}`
@hero hero.svg
@demo demo/index.html
-->
<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;
}
paper-material {
border-radius: 2px;
background-color: var(--paper-menu-button-dropdown-background, --primary-background-color);
@apply(--paper-menu-button-dropdown);
}
</style>
<template>
<div id="trigger" on-tap="open">
<content select=".dropdown-trigger"></content>
</div>
<iron-dropdown
id="dropdown"
opened="{{opened}}"
horizontal-align="[[horizontalAlign]]"
vertical-align="[[verticalAlign]]"
horizontal-offset="[[horizontalOffset]]"
vertical-offset="[[verticalOffset]]"
open-animation-config="[[openAnimationConfig]]"
close-animation-config="[[closeAnimationConfig]]"
no-animations="[[noAnimations]]">
<paper-material class="dropdown-content">
<content select=".dropdown-content"></content>
</paper-material>
</iron-dropdown>
</template>
</dom-module>
<script>
(function() {
'use strict';
var PaperMenuButton = Polymer({
is: 'paper-menu-button',
/**
* Fired when the dropdown opens.
*
* @event paper-dropdown-open
*/
/**
* 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
},
/**
* 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.
*/
ignoreActivate: {
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'
}
}];
}
}
},
hostAttributes: {
role: 'group',
'aria-haspopup': 'true'
},
listeners: {
'iron-activate': '_onIronActivate'
},
/**
* 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-activate` 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-activate"`.
*/
_onIronActivate: function(event) {
if (!this.ignoreActivate) {
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) {
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>

View file

@ -0,0 +1,25 @@
<!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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>paper-menu-button tests</title>
<script src="../../web-component-tester/browser.js"></script>
</head>
<body>
<script>
WCT.loadSuites([
'paper-menu-button.html'
]);
</script>
</body>
</html>

View file

@ -0,0 +1,109 @@
<!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>
<meta charset="UTF-8">
<title>paper-menu-button basic tests</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<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="../paper-menu-button.html">
<link rel="import" href="../../test-fixture/test-fixture.html">
</head>
<body>
<test-fixture id="TrivialMenuButton">
<template>
<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;
var trigger;
var content;
setup(function() {
menuButton = fixture('TrivialMenuButton');
trigger = Polymer.dom(menuButton).querySelector('.dropdown-trigger');
content = Polymer.dom(menuButton).querySelector('.dropdown-content');
});
test('opens when trigger is clicked', function(done) {
var contentRect;
contentRect = content.getBoundingClientRect();
expect(contentRect.width).to.be.equal(0);
expect(contentRect.height).to.be.equal(0);
MockInteractions.tap(trigger);
Polymer.Base.async(function() {
contentRect = content.getBoundingClientRect();
expect(menuButton.opened).to.be.equal(true);
expect(contentRect.width).to.be.greaterThan(0);
expect(contentRect.height).to.be.greaterThan(0);
done();
});
});
test('closes when trigger is clicked again', function(done) {
MockInteractions.tap(trigger);
Polymer.Base.async(function() {
MockInteractions.tap(trigger);
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);
});
test('closes when disabled while open', function() {
var contentRect;
menuButton.opened = true;
menuButton.disabled = true;
expect(menuButton.opened).to.be.equal(false);
contentRect = content.getBoundingClientRect();
expect(contentRect.width).to.be.equal(0);
expect(contentRect.height).to.be.equal(0);
});
test('has aria-haspopup attribute', function() {
expect(menuButton.hasAttribute('aria-haspopup')).to.be.equal(true);
});
});
</script>
</body>
</html>