Add paper-toast polymer component to polymer 1.8.1
Bug:
Change-Id: I6b3cfb9ccef1c50bf993005d7b0781e662a83a06
diff --git a/polymer_1.8.1/bower.json b/polymer_1.8.1/bower.json
index f47412e..04d65ce 100644
--- a/polymer_1.8.1/bower.json
+++ b/polymer_1.8.1/bower.json
@@ -22,7 +22,8 @@
"paper-radio-button": "^1.2.1",
"paper-radio-group": "^1.2.0",
"paper-spinner": "^1.2.0",
- "paper-tooltip": "^1.1.3"
+ "paper-tooltip": "^1.1.3",
+ "paper-toast": "^1.3.1"
},
"devDependencies": {
"web-component-tester": "^4.0.0"
diff --git a/polymer_1.8.1/bower_components/paper-toast/.bower.json b/polymer_1.8.1/bower_components/paper-toast/.bower.json
new file mode 100644
index 0000000..1212ad7
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/.bower.json
@@ -0,0 +1,45 @@
+{
+ "name": "paper-toast",
+ "version": "1.3.1",
+ "description": "A material design notification toast",
+ "private": true,
+ "license": "http://polymer.github.io/LICENSE.txt",
+ "authors": [
+ "The Polymer Authors"
+ ],
+ "keywords": [
+ "web-components",
+ "polymer",
+ "toast",
+ "notification"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/PolymerElements/paper-toast.git"
+ },
+ "main": "paper-toast.html",
+ "dependencies": {
+ "iron-a11y-announcer": "PolymerElements/iron-a11y-announcer#^1.0.0",
+ "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.9",
+ "iron-fit-behavior": "PolymerElements/iron-fit-behavior#^1.1.0",
+ "polymer": "Polymer/polymer#^1.5.0"
+ },
+ "devDependencies": {
+ "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
+ "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0",
+ "paper-button": "PolymerElements/paper-button#^1.0.0",
+ "web-component-tester": "^4.0.0",
+ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
+ },
+ "ignore": [],
+ "homepage": "https://github.com/PolymerElements/paper-toast",
+ "_release": "1.3.1",
+ "_resolution": {
+ "type": "version",
+ "tag": "v1.3.1",
+ "commit": "832ba27b6446711bc703717afdae2ac6485568ef"
+ },
+ "_source": "https://github.com/PolymerElements/paper-toast.git",
+ "_target": "^1.3.1",
+ "_originalSource": "paper-toast"
+}
\ No newline at end of file
diff --git a/polymer_1.8.1/bower_components/paper-toast/.github/ISSUE_TEMPLATE.md b/polymer_1.8.1/bower_components/paper-toast/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..9251e7f
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,33 @@
+<!-- Instructions: https://github.com/PolymerElements/paper-toast/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
diff --git a/polymer_1.8.1/bower_components/paper-toast/.gitignore b/polymer_1.8.1/bower_components/paper-toast/.gitignore
new file mode 100644
index 0000000..8d4ae25
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/.gitignore
@@ -0,0 +1 @@
+bower_components
diff --git a/polymer_1.8.1/bower_components/paper-toast/.travis.yml b/polymer_1.8.1/bower_components/paper-toast/.travis.yml
new file mode 100644
index 0000000..f240974
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/.travis.yml
@@ -0,0 +1,24 @@
+language: node_js
+sudo: required
+before_script:
+ - npm install -g bower polylint web-component-tester
+ - bower install
+ - polylint
+env:
+ global:
+ - secure: >-
+ fg+1RZ1aJQfxiM42iXvK8hj8L9RN8zX6IEjhuxFgNcgBY786DCyy9CIn1Gz4esv+4ZXyJfLyCbzGi8NMrzc6j3nbmewRKf3/zkX5NI4at82EvlkkN8Bcp7z+AV871LyLeV5q94waiR6+9/2LHega+F96pyl/4SAKxk2Gmh3BuPk=
+ - secure: >-
+ VkX13Tu1Ojr/2ZRXRORize8w4tlNo2bBUYEbEDF/RtcoxQeTffjAigmZ1q4Z/eZaA41JI/Fh90HUzZRg9V0W+TGT3t6htK9zxZq9zygM6sHVpOayxGInEW1TcMSM3QlcRI+3y8xUeCgpCmBmLLLI8K+HENRi1trg4C2HJk4JCN8=
+node_js: '6'
+addons:
+ firefox: latest
+ apt:
+ sources:
+ - google-chrome
+ packages:
+ - google-chrome-stable
+script:
+ - xvfb-run wct
+ - 'if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then wct -s ''default''; fi'
+dist: trusty
diff --git a/polymer_1.8.1/bower_components/paper-toast/CONTRIBUTING.md b/polymer_1.8.1/bower_components/paper-toast/CONTRIBUTING.md
new file mode 100644
index 0000000..093090d
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/CONTRIBUTING.md
@@ -0,0 +1,77 @@
+<!--
+This file is autogenerated based on
+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
+
+Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
+
+### Filing Issues
+
+**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
+
+ 1. **Who will use the feature?** _“As someone filling out a form…”_
+ 2. **When will they use the feature?** _“When I enter an invalid value…”_
+ 3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_
+
+**If you are filing an issue to report a bug**, please provide:
+
+ 1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
+
+ ```markdown
+ The `paper-foo` element causes the page to turn pink when clicked.
+
+ ## Expected outcome
+
+ The page stays the same color.
+
+ ## Actual outcome
+
+ The page turns pink.
+
+ ## Steps to reproduce
+
+ 1. Put a `paper-foo` element in the page.
+ 2. Open the page in a web browser.
+ 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: [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.
+
+### Submitting Pull Requests
+
+**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
+
+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 in the pull request description using the following syntax:
+
+ ```markdown
+ (For a single issue)
+ Fixes #20
+
+ (For multiple issues)
+ Fixes #32, fixes #40
+ ```
+
+ 2. **A succinct description of the design** used to fix any related issues. For example:
+
+ ```markdown
+ This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
+ ```
+
+ 3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
+
+If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that!
diff --git a/polymer_1.8.1/bower_components/paper-toast/README.md b/polymer_1.8.1/bower_components/paper-toast/README.md
new file mode 100644
index 0000000..3c9287d
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/README.md
@@ -0,0 +1,72 @@
+
+<!---
+
+This README is automatically generated from the comments in these files:
+paper-toast.html
+
+Edit those files, and our readme bot will duplicate them over here!
+Edit this file, and the bot will squash your changes :)
+
+The bot does some handling of markdown. Please file a bug if it does the wrong
+thing! https://github.com/PolymerLabs/tedium/issues
+
+-->
+
+[](https://travis-ci.org/PolymerElements/paper-toast)
+
+_[Demo and API docs](https://elements.polymer-project.org/elements/paper-toast)_
+
+
+##<paper-toast>
+
+Material design: [Snackbars & toasts](https://www.google.com/design/spec/components/snackbars-toasts.html)
+
+`paper-toast` provides a subtle notification toast. Only one `paper-toast` will
+be visible on screen.
+
+Use `opened` to show the toast:
+
+Example:
+
+```html
+<paper-toast text="Hello world!" opened></paper-toast>
+```
+
+Also `open()` or `show()` can be used to show the toast:
+
+Example:
+
+```html
+<paper-button on-click="openToast">Open Toast</paper-button>
+<paper-toast id="toast" text="Hello world!"></paper-toast>
+
+...
+
+openToast: function() {
+ this.$.toast.open();
+}
+```
+
+Set `duration` to 0, a negative number or Infinity to persist the toast on screen:
+
+Example:
+
+```html
+<paper-toast text="Terms and conditions" opened duration="0">
+ <a href="#">Show more</a>
+</paper-toast>
+```
+
+### Styling
+
+The following custom properties and mixins are available for styling:
+
+| Custom property | Description | Default |
+| --- | --- | --- |
+| `--paper-toast-background-color` | The paper-toast background-color | `#323232` |
+| `--paper-toast-color` | The paper-toast color | `#f1f1f1` |
+
+This element applies the mixin `--paper-font-common-base` but does not import `paper-styles/typography.html`.
+In order to apply the `Roboto` font to this element, make sure you've imported `paper-styles/typography.html`.
+
+
diff --git a/polymer_1.8.1/bower_components/paper-toast/bower.json b/polymer_1.8.1/bower_components/paper-toast/bower.json
new file mode 100644
index 0000000..2a2b34b
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/bower.json
@@ -0,0 +1,35 @@
+{
+ "name": "paper-toast",
+ "version": "1.3.1",
+ "description": "A material design notification toast",
+ "private": true,
+ "license": "http://polymer.github.io/LICENSE.txt",
+ "authors": [
+ "The Polymer Authors"
+ ],
+ "keywords": [
+ "web-components",
+ "polymer",
+ "toast",
+ "notification"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/PolymerElements/paper-toast.git"
+ },
+ "main": "paper-toast.html",
+ "dependencies": {
+ "iron-a11y-announcer": "PolymerElements/iron-a11y-announcer#^1.0.0",
+ "iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.9",
+ "iron-fit-behavior": "PolymerElements/iron-fit-behavior#^1.1.0",
+ "polymer": "Polymer/polymer#^1.5.0"
+ },
+ "devDependencies": {
+ "iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
+ "iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.0.0",
+ "paper-button": "PolymerElements/paper-button#^1.0.0",
+ "web-component-tester": "^4.0.0",
+ "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
+ },
+ "ignore": []
+}
diff --git a/polymer_1.8.1/bower_components/paper-toast/demo/index.html b/polymer_1.8.1/bower_components/paper-toast/demo/index.html
new file mode 100644
index 0000000..1263883
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/demo/index.html
@@ -0,0 +1,96 @@
+<!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>
+ <title>paper-toast</title>
+
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
+ <meta name="mobile-web-app-capable" content="yes">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+
+ <link rel="import" href="../paper-toast.html">
+ <link rel="import" href="../../paper-button/paper-button.html">
+ <link rel="import" href="../../iron-demo-helpers/demo-snippet.html">
+ <link rel="import" href="../../iron-demo-helpers/demo-pages-shared-styles.html">
+
+ <style is="custom-style" include="demo-pages-shared-styles"></style>
+
+</head>
+
+<body unresolved class="centered">
+ <h3>Toast auto-closes after 3 seconds. Only one toast per time will be visible</h3>
+ <demo-snippet class="centered-demo">
+ <template>
+ <paper-button raised onclick="toast0.open()">Default toast</paper-button>
+ <paper-toast id="toast0" text="This toast auto-closes after 3 seconds"></paper-toast>
+ </template>
+ </demo-snippet>
+
+ <h3>Toast does not auto-close when <code>duration</code> is negative, <code>0</code>, or <code>Infinity</code></h3>
+ <demo-snippet class="centered-demo">
+ <template>
+ <style>
+ .yellow-button {
+ text-transform: none;
+ color: #eeff41;
+ }
+ </style>
+
+ <paper-button raised onclick="toast1.open()">Persistent toast</paper-button>
+
+ <paper-toast id="toast1" duration="0" text="This toast will stay opened until you close it, or open another toast.">
+ <paper-button onclick="toast1.toggle()" class="yellow-button">Close now!</paper-button>
+ </paper-toast>
+ </template>
+ </demo-snippet>
+
+ <h3>Toast can be styled</h3>
+ <demo-snippet class="centered-demo">
+ <template>
+ <style is="custom-style">
+ #toast2 {
+ --paper-toast-background-color: red;
+ --paper-toast-color: white;
+ }
+ </style>
+
+ <paper-button raised onclick="toast2.open()">Styled toast</paper-button>
+
+ <paper-toast id="toast2" class="fit-bottom" text="This toast is red and fits bottom!"></paper-toast>
+ </template>
+ </demo-snippet>
+
+ <h3>Toast can fit into any element</h3>
+ <demo-snippet class="centered-demo">
+ <template>
+ <style>
+ #container {
+ padding: 100px;
+ border: 1px solid gray;
+ }
+ </style>
+ <div id="container">
+ <paper-button raised onclick="toast3.open()">Open toast</paper-button>
+ </div>
+ <paper-toast id="toast3" class="fit-bottom" text="This toast fits into the container."></paper-toast>
+
+ <script>
+ toast3.fitInto = container;
+ </script>
+
+ </template>
+ </demo-snippet>
+</body>
+
+</html>
diff --git a/polymer_1.8.1/bower_components/paper-toast/hero.svg b/polymer_1.8.1/bower_components/paper-toast/hero.svg
new file mode 100755
index 0000000..c82a707
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/hero.svg
@@ -0,0 +1,20 @@
+<?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">
+ <path d="M164,114H13V88h151V114z M15,112h147V90H15V112z"/>
+ <rect x="26" y="100" width="79" height="2"/>
+ <rect x="135" y="100" width="16" height="2"/>
+ <g id="ic_x5F_add_x0D_">
+ </g>
+</g>
+<g id="Guides">
+</g>
+</svg>
diff --git a/polymer_1.8.1/bower_components/paper-toast/index.html b/polymer_1.8.1/bower_components/paper-toast/index.html
new file mode 100644
index 0000000..487bb5c
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/index.html
@@ -0,0 +1,26 @@
+<!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, initial-scale=1.0">
+
+ <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>
diff --git a/polymer_1.8.1/bower_components/paper-toast/paper-toast.html b/polymer_1.8.1/bower_components/paper-toast/paper-toast.html
new file mode 100644
index 0000000..5a7d705
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/paper-toast.html
@@ -0,0 +1,323 @@
+<!--
+@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-a11y-announcer/iron-a11y-announcer.html">
+<link rel="import" href="../iron-overlay-behavior/iron-overlay-behavior.html">
+
+<!--
+Material design: [Snackbars & toasts](https://www.google.com/design/spec/components/snackbars-toasts.html)
+
+`paper-toast` provides a subtle notification toast. Only one `paper-toast` will
+be visible on screen.
+
+Use `opened` to show the toast:
+
+Example:
+
+ <paper-toast text="Hello world!" opened></paper-toast>
+
+Also `open()` or `show()` can be used to show the toast:
+
+Example:
+
+ <paper-button on-click="openToast">Open Toast</paper-button>
+ <paper-toast id="toast" text="Hello world!"></paper-toast>
+
+ ...
+
+ openToast: function() {
+ this.$.toast.open();
+ }
+
+Set `duration` to 0, a negative number or Infinity to persist the toast on screen:
+
+Example:
+
+ <paper-toast text="Terms and conditions" opened duration="0">
+ <a href="#">Show more</a>
+ </paper-toast>
+
+
+### Styling
+The following custom properties and mixins are available for styling:
+
+Custom property | Description | Default
+----------------|-------------|----------
+`--paper-toast-background-color` | The paper-toast background-color | `#323232`
+`--paper-toast-color` | The paper-toast color | `#f1f1f1`
+
+This element applies the mixin `--paper-font-common-base` but does not import `paper-styles/typography.html`.
+In order to apply the `Roboto` font to this element, make sure you've imported `paper-styles/typography.html`.
+
+@group Paper Elements
+@element paper-toast
+@demo demo/index.html
+@hero hero.svg
+-->
+
+<dom-module id="paper-toast">
+ <template>
+ <style>
+ :host {
+ display: block;
+ position: fixed;
+ background-color: var(--paper-toast-background-color, #323232);
+ color: var(--paper-toast-color, #f1f1f1);
+ min-height: 48px;
+ min-width: 288px;
+ padding: 16px 24px;
+ box-sizing: border-box;
+ box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
+ border-radius: 2px;
+ margin: 12px;
+ font-size: 14px;
+ cursor: default;
+ -webkit-transition: -webkit-transform 0.3s, opacity 0.3s;
+ transition: transform 0.3s, opacity 0.3s;
+ opacity: 0;
+ -webkit-transform: translateY(100px);
+ transform: translateY(100px);
+ @apply(--paper-font-common-base);
+ }
+
+ :host(.capsule) {
+ border-radius: 24px;
+ }
+
+ :host(.fit-bottom) {
+ width: 100%;
+ min-width: 0;
+ border-radius: 0;
+ margin: 0;
+ }
+
+ :host(.paper-toast-open) {
+ opacity: 1;
+ -webkit-transform: translateY(0px);
+ transform: translateY(0px);
+ }
+ </style>
+
+ <span id="label">{{text}}</span>
+ <content></content>
+ </template>
+
+ <script>
+ (function() {
+ // Keeps track of the toast currently opened.
+ var currentToast = null;
+
+ Polymer({
+ is: 'paper-toast',
+
+ behaviors: [
+ Polymer.IronOverlayBehavior
+ ],
+
+ properties: {
+ /**
+ * The element to fit `this` into.
+ * Overridden from `Polymer.IronFitBehavior`.
+ */
+ fitInto: {
+ type: Object,
+ value: window,
+ observer: '_onFitIntoChanged'
+ },
+
+ /**
+ * The orientation against which to align the dropdown content
+ * horizontally relative to `positionTarget`.
+ * Overridden from `Polymer.IronFitBehavior`.
+ */
+ horizontalAlign: {
+ type: String,
+ value: 'left'
+ },
+
+ /**
+ * The orientation against which to align the dropdown content
+ * vertically relative to `positionTarget`.
+ * Overridden from `Polymer.IronFitBehavior`.
+ */
+ verticalAlign: {
+ type: String,
+ value: 'bottom'
+ },
+
+ /**
+ * The duration in milliseconds to show the toast.
+ * Set to `0`, a negative number, or `Infinity`, to disable the
+ * toast auto-closing.
+ */
+ duration: {
+ type: Number,
+ value: 3000
+ },
+
+ /**
+ * The text to display in the toast.
+ */
+ text: {
+ type: String,
+ value: ''
+ },
+
+ /**
+ * Overridden from `IronOverlayBehavior`.
+ * Set to false to enable closing of the toast by clicking outside it.
+ */
+ noCancelOnOutsideClick: {
+ type: Boolean,
+ value: true
+ },
+
+ /**
+ * Overridden from `IronOverlayBehavior`.
+ * Set to true to disable auto-focusing the toast or child nodes with
+ * the `autofocus` attribute` when the overlay is opened.
+ */
+ noAutoFocus: {
+ type: Boolean,
+ value: true
+ }
+ },
+
+ listeners: {
+ 'transitionend': '__onTransitionEnd'
+ },
+
+ /**
+ * Read-only. Deprecated. Use `opened` from `IronOverlayBehavior`.
+ * @property visible
+ * @deprecated
+ */
+ get visible() {
+ Polymer.Base._warn('`visible` is deprecated, use `opened` instead');
+ return this.opened;
+ },
+
+ /**
+ * Read-only. Can auto-close if duration is a positive finite number.
+ * @property _canAutoClose
+ */
+ get _canAutoClose() {
+ return this.duration > 0 && this.duration !== Infinity;
+ },
+
+ created: function() {
+ this._autoClose = null;
+ Polymer.IronA11yAnnouncer.requestAvailability();
+ },
+
+ /**
+ * Show the toast. Without arguments, this is the same as `open()` from `IronOverlayBehavior`.
+ * @param {(Object|string)=} properties Properties to be set before opening the toast.
+ * e.g. `toast.show('hello')` or `toast.show({text: 'hello', duration: 3000})`
+ */
+ show: function(properties) {
+ if (typeof properties == 'string') {
+ properties = { text: properties };
+ }
+ for (var property in properties) {
+ if (property.indexOf('_') === 0) {
+ Polymer.Base._warn('The property "' + property + '" is private and was not set.');
+ } else if (property in this) {
+ this[property] = properties[property];
+ } else {
+ Polymer.Base._warn('The property "' + property + '" is not valid.');
+ }
+ }
+ this.open();
+ },
+
+ /**
+ * Hide the toast. Same as `close()` from `IronOverlayBehavior`.
+ */
+ hide: function() {
+ this.close();
+ },
+
+ /**
+ * Called on transitions of the toast, indicating a finished animation
+ * @private
+ */
+ __onTransitionEnd: function(e) {
+ // there are different transitions that are happening when opening and
+ // closing the toast. The last one so far is for `opacity`.
+ // This marks the end of the transition, so we check for this to determine if this
+ // is the correct event.
+ if (e && e.target === this && e.propertyName === 'opacity') {
+ if (this.opened) {
+ this._finishRenderOpened();
+ } else {
+ this._finishRenderClosed();
+ }
+ }
+ },
+
+ /**
+ * Overridden from `IronOverlayBehavior`.
+ * Called when the value of `opened` changes.
+ */
+ _openedChanged: function() {
+ if (this._autoClose !== null) {
+ this.cancelAsync(this._autoClose);
+ this._autoClose = null;
+ }
+ if (this.opened) {
+ if (currentToast && currentToast !== this) {
+ currentToast.close();
+ }
+ currentToast = this;
+ this.fire('iron-announce', {
+ text: this.text
+ });
+ if (this._canAutoClose) {
+ this._autoClose = this.async(this.close, this.duration);
+ }
+ } else if (currentToast === this) {
+ currentToast = null;
+ }
+ Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments);
+ },
+
+ /**
+ * Overridden from `IronOverlayBehavior`.
+ */
+ _renderOpened: function() {
+ this.classList.add('paper-toast-open');
+ },
+
+ /**
+ * Overridden from `IronOverlayBehavior`.
+ */
+ _renderClosed: function() {
+ this.classList.remove('paper-toast-open');
+ },
+
+ /**
+ * @private
+ */
+ _onFitIntoChanged: function(fitInto) {
+ this.positionTarget = fitInto;
+ }
+
+ /**
+ * Fired when `paper-toast` is opened.
+ *
+ * @event 'iron-announce'
+ * @param {{text: string}} detail Contains text that will be announced.
+ */
+ });
+ })();
+ </script>
+</dom-module>
diff --git a/polymer_1.8.1/bower_components/paper-toast/test/basic.html b/polymer_1.8.1/bower_components/paper-toast/test/basic.html
new file mode 100644
index 0000000..154015d
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/test/basic.html
@@ -0,0 +1,243 @@
+<!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>
+
+ <title>paper-toast-basic</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+
+ <link rel="import" href="../paper-toast.html">
+
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ </style>
+</head>
+
+<body>
+
+ <test-fixture id="basic">
+ <template>
+ <paper-toast></paper-toast>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="show">
+ <template>
+ <paper-toast opened></paper-toast>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="contained">
+ <template>
+ <paper-toast class="fit-bottom"></paper-toast>
+ <div style="margin: 50px; width: 100px; height: 100px; background-color: orange;"></div>
+ </template>
+ </test-fixture>
+
+ <script>
+
+ suite('basic', function() {
+
+ var toast;
+
+ test('is hidden', function() {
+ toast = fixture('basic');
+ assert.isFalse(toast.opened, '`opened` is false');
+ });
+
+ test('is visible', function() {
+ toast = fixture('show');
+ assert.isTrue(toast.opened, '`opened` is true');
+ });
+
+ test('show() will open toast', function() {
+ toast = fixture('basic');
+ toast.show();
+ assert.isTrue(toast.opened, '`opened` is true');
+ });
+
+ test('hide() will close toast', function() {
+ toast = fixture('show');
+ toast.hide();
+ assert.isFalse(toast.opened, '`opened` is false');
+ });
+
+ test('toast auto-close after 10ms', function(done) {
+ toast = fixture('basic');
+ toast.duration = 10;
+ toast.show();
+ setTimeout(function() {
+ assert.isFalse(toast.opened, '`opened` is false');
+ done();
+ }, 12);
+ });
+
+ test('toast fires opened event', function(done) {
+ toast = fixture('show');
+ toast.addEventListener('iron-overlay-opened', function() {
+ done();
+ });
+ });
+
+ test('toast does not get focused', function(done) {
+ toast = fixture('show');
+ var spy = sinon.spy(toast, 'focus');
+ assert.isTrue(toast.noAutoFocus, 'no-auto-focus is true');
+ toast.addEventListener('iron-overlay-opened', function() {
+ assert.isFalse(spy.called, 'toast is not focused');
+ done();
+ });
+ });
+
+ test('toast fires closed event', function(done) {
+ toast = fixture('basic');
+ toast.show({duration: 350});
+ toast.addEventListener('iron-overlay-closed', function() {
+ done();
+ });
+ });
+
+ test('show() accepts valid properties', function() {
+ toast = fixture('basic');
+ toast.show({text: 'hello world', duration: 20});
+ assert.isTrue(toast.opened, '`opened` is true');
+ assert.equal(toast.text, 'hello world', '`text` is correct');
+ assert.equal(toast.duration, 20, '`duration` is correct');
+ });
+
+ test('show() does not accept invalid properties', function() {
+ toast = fixture('basic');
+ toast.show({foo: 'bar'});
+ assert.isUndefined(toast.foo, '`foo` is not a valid property and will not be set');
+ assert.isTrue(toast.opened, '`opened` is true');
+ });
+
+ test('show() does not accept private properties', function() {
+ toast = fixture('basic');
+ var temp = toast._manager;
+ toast.show({_manager: 'bar'});
+ assert.equal(toast._manager, temp, '`_manager` is a private property and will not be set');
+ assert.isTrue(toast.opened, '`opened` is true');
+ });
+
+ test('show() accepts a string argument as the text parameter', function() {
+ toast = fixture('basic');
+ toast.show('hello world 2');
+ assert.equal(toast.text, 'hello world 2', '`text is correct`');
+ });
+
+ suite('disable auto-close', function() {
+ var spy;
+ setup(function() {
+ toast = fixture('basic');
+ spy = sinon.spy(toast, 'async');
+ });
+ test('duration = Infinity', function() {
+ toast.duration = Infinity;
+ toast.show();
+ assert.isFalse(spy.calledWith(toast.close), '`async` was not called with `close()`');
+ assert.isFalse(spy.calledWith(toast.hide), '`async` was not called with `hide()`');
+ });
+
+ test('duration = 0', function() {
+ toast.duration = 0;
+ toast.show();
+ assert.isFalse(spy.calledWith(toast.close), '`async` was not called with `close()`');
+ assert.isFalse(spy.calledWith(toast.hide), '`async` was not called with `hide()`');
+ });
+
+ test('duration = -10', function() {
+ toast.duration = -10;
+ toast.show();
+ assert.isFalse(spy.calledWith(toast.close), '`async` was not called with `close()`');
+ assert.isFalse(spy.calledWith(toast.hide), '`async` was not called with `hide()`');
+ });
+ });
+
+ test('there is only 1 toast opened', function() {
+ var toast1 = fixture('basic');
+ var toast2 = fixture('show');
+ toast2.open();
+ toast1.open();
+ assert.isTrue(toast1.opened, 'toast1 is opened');
+ assert.isFalse(toast2.opened, 'toast2 is not opened');
+ toast2.open();
+ assert.isFalse(toast1.opened, 'toast1 is now not opened');
+ assert.isTrue(toast2.opened, 'toast2 is now opened');
+ });
+
+ test('auto-close is correctly reset', function(done) {
+ toast = fixture('basic');
+ toast.duration = 10;
+ toast.show();
+ // a bit later (before the auto-close), toast is reset
+ setTimeout(function() {
+ toast.hide();
+ // keep toast opened
+ toast.duration = 0;
+ toast.show();
+ setTimeout(function() {
+ assert.isTrue(toast.opened, 'toast is still open');
+ done();
+ }, 10);
+ }, 5);
+ });
+
+ test('toast is positioned according at the bottom left of its fitInto', function(done) {
+ var f = fixture('contained');
+ var toast = f[0];
+ var container = f[1];
+ toast.fitInto = container;
+ toast.open();
+ // Wait for it to be opened, so it will be sized correctly.
+ toast.addEventListener('iron-overlay-opened', function() {
+ var rect = toast.getBoundingClientRect();
+ assert.equal(rect.left, 50, 'left ok');
+ // 150px from top, (100px of height + 50px of margin-top)
+ assert.equal(rect.bottom, 150, 'bottom');
+ done();
+ });
+ });
+
+ suite('a11y', function() {
+ test('show() will announce text', function() {
+ toast = fixture('basic');
+ var spy = sinon.spy(toast, 'fire');
+ toast.text = 'announce!';
+ toast.show();
+ assert.isTrue(spy.calledWith('iron-announce', {
+ text: 'announce!'
+ }), 'text announced');
+ });
+
+ test('hide() will not announce text', function() {
+ toast = fixture('show');
+ var spy = sinon.spy(toast, 'fire');
+ toast.hide();
+ assert.isFalse(spy.calledWith('iron-announce'), 'text not announced');
+ });
+ });
+
+ });
+ </script>
+
+</body>
+
+</html>
diff --git a/polymer_1.8.1/bower_components/paper-toast/test/index.html b/polymer_1.8.1/bower_components/paper-toast/test/index.html
new file mode 100644
index 0000000..c058372
--- /dev/null
+++ b/polymer_1.8.1/bower_components/paper-toast/test/index.html
@@ -0,0 +1,31 @@
+<!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>Tests</title>
+ <script src="../../web-component-tester/browser.js"></script>
+
+ </head>
+ <body>
+
+ <script>
+
+ WCT.loadSuites([
+ 'basic.html'
+ ]);
+
+ </script>
+
+ </body>
+</html>