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
4a4c20e7c6
commit
ee03ef4f51
27 changed files with 1767 additions and 21 deletions
|
@ -16,12 +16,12 @@
|
|||
},
|
||||
"devDependencies": {},
|
||||
"ignore": [],
|
||||
"version": "1.1.91",
|
||||
"_release": "1.1.91",
|
||||
"version": "1.1.92",
|
||||
"_release": "1.1.92",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.1.91",
|
||||
"commit": "8a268bdd807a875626f387dd8f4a0c4d0cff0a5f"
|
||||
"tag": "1.1.92",
|
||||
"commit": "b8a3cb7ffffe461b43e389650bd5c14170ea9eb7"
|
||||
},
|
||||
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
|
||||
"_target": "~1.1.5",
|
||||
|
|
|
@ -75,8 +75,14 @@ define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css
|
|||
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||
|
||||
submitValue = dlg.querySelector('.txtPromptValue').value;
|
||||
dialogHelper.close(dlg);
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Important, don't close the dialog until after the form has completed submitting, or it will cause an error in Chrome
|
||||
setTimeout(function () {
|
||||
dialogHelper.close(dlg);
|
||||
}, 300);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -99,6 +105,7 @@ define(['dialogHelper', 'layoutManager', 'dialogText', 'html!./icons.html', 'css
|
|||
|
||||
return dialogHelper.open(dlg).then(function () {
|
||||
var value = submitValue;
|
||||
|
||||
if (value) {
|
||||
return value;
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-demo-helpers",
|
||||
"version": "1.1.1",
|
||||
"version": "1.2.0",
|
||||
"description": "Utility classes to make building demo pages easier",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -10,7 +10,10 @@
|
|||
"polymer",
|
||||
"demo"
|
||||
],
|
||||
"main": "demo-snippet.html",
|
||||
"main": [
|
||||
"demo-snippet.html",
|
||||
"url-bar.html"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -25,7 +28,8 @@
|
|||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"marked-element": "polymerelements/marked-element#^1.0.0",
|
||||
"prism-element": "PolymerElements/prism-element#^1.0.0"
|
||||
"prism-element": "PolymerElements/prism-element#^1.0.0",
|
||||
"iron-location": "PolymerElements/iron-location#^0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
|
||||
|
@ -37,11 +41,11 @@
|
|||
"paper-styles": "PolymerElements/paper-styles#^1.1.0",
|
||||
"paper-checkbox": "PolymerElements/paper-checkbox#^1.0.0"
|
||||
},
|
||||
"_release": "1.1.1",
|
||||
"_release": "1.2.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.1.1",
|
||||
"commit": "49584de566eae4f6c31cd1078ce0407b53c601eb"
|
||||
"tag": "v1.2.0",
|
||||
"commit": "b5385d0e1c6645560967dee564a43e66dfdf1993"
|
||||
},
|
||||
"_source": "git://github.com/polymerelements/iron-demo-helpers.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
33
dashboard-ui/bower_components/iron-demo-helpers/.github/ISSUE_TEMPLATE.md
vendored
Normal file
33
dashboard-ui/bower_components/iron-demo-helpers/.github/ISSUE_TEMPLATE.md
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<!-- Instructions: https://github.com/PolymerElements/iron-demo-helpers/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,6 +1,6 @@
|
|||
{
|
||||
"name": "iron-demo-helpers",
|
||||
"version": "1.1.1",
|
||||
"version": "1.2.0",
|
||||
"description": "Utility classes to make building demo pages easier",
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
|
@ -10,7 +10,7 @@
|
|||
"polymer",
|
||||
"demo"
|
||||
],
|
||||
"main": "demo-snippet.html",
|
||||
"main": ["demo-snippet.html", "url-bar.html"],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -25,7 +25,8 @@
|
|||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"marked-element": "polymerelements/marked-element#^1.0.0",
|
||||
"prism-element": "PolymerElements/prism-element#^1.0.0"
|
||||
"prism-element": "PolymerElements/prism-element#^1.0.0",
|
||||
"iron-location": "PolymerElements/iron-location#^0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
|
||||
|
|
47
dashboard-ui/bower_components/iron-demo-helpers/demo/url-bar.html
vendored
Normal file
47
dashboard-ui/bower_components/iron-demo-helpers/demo/url-bar.html
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
<!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 lang="en">
|
||||
<head>
|
||||
<title>url-bar demo</title>
|
||||
<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, user-scalable=yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../url-bar.html">
|
||||
<link rel="import" href="../demo-pages-shared-styles.html">
|
||||
|
||||
<style is="custom-style" include="demo-pages-shared-styles">
|
||||
iframe {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body unresolved>
|
||||
<url-bar></url-bar>
|
||||
|
||||
<div id='message'></div>
|
||||
|
||||
<script>
|
||||
var message;
|
||||
if (window.top !== window) {
|
||||
message = 'URL Bar should appear above this text';
|
||||
} else {
|
||||
message = 'No URL Bar above this text. iframe below this text with URL bar.';
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('src', window.location.href);
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
document.querySelector('#message').innerText = message;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -22,7 +22,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
</head>
|
||||
<body>
|
||||
|
||||
<iron-component-page></iron-component-page>
|
||||
<iron-component-page src="demo-snippet.html"></iron-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
71
dashboard-ui/bower_components/iron-demo-helpers/url-bar.html
vendored
Normal file
71
dashboard-ui/bower_components/iron-demo-helpers/url-bar.html
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-location/iron-location.html">
|
||||
<link rel="import" href="../iron-flex-layout/iron-flex-layout-classes.html">
|
||||
|
||||
<!--
|
||||
`url-bar` is a helper element that displays a simple read-only URL bar if
|
||||
and only if the page is in an iframe. In this way we can demo elements that
|
||||
deal with the URL in our iframe-based demo environments.
|
||||
|
||||
If the page is not in an iframe, the url-bar element is not displayed.
|
||||
|
||||
@element url-bar
|
||||
@demo demo/url-bar.html
|
||||
-->
|
||||
<dom-module id='url-bar'>
|
||||
<template>
|
||||
<style include="iron-flex">
|
||||
:host {
|
||||
margin: 0px;
|
||||
padding: 15px 35px;
|
||||
border-bottom: 2px solid gray;
|
||||
height: 1em;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
}
|
||||
:host[in-iframe] {
|
||||
/* This element only wants to be displayed if it's in an iframe. */
|
||||
display: block;
|
||||
}
|
||||
label {
|
||||
display: inline-block;
|
||||
padding-right: 25px;
|
||||
}
|
||||
span {
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
</style>
|
||||
<iron-location path="{{path}}" query="{{query}}" hash="{{hash}}">
|
||||
</iron-location>
|
||||
<div class="layout horizontal">
|
||||
<label>URL</label><span>{{url}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'url-bar',
|
||||
properties: {
|
||||
url: {
|
||||
computed: '__computeUrl(path, query, hash)'
|
||||
},
|
||||
inIframe: {
|
||||
value: function() {
|
||||
return window.top !== window;
|
||||
},
|
||||
reflectToAttribute: true
|
||||
}
|
||||
},
|
||||
__computeUrl: function(path, query, hash) {
|
||||
var url = path;
|
||||
if (query) {
|
||||
url += '?' + query;
|
||||
}
|
||||
if (hash) {
|
||||
url += '#' + hash;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</dom-module>
|
45
dashboard-ui/bower_components/iron-location/.bower.json
vendored
Normal file
45
dashboard-ui/bower_components/iron-location/.bower.json
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"name": "iron-location",
|
||||
"version": "0.8.0",
|
||||
"description": "Bidirectional data binding into the page's URL.",
|
||||
"private": true,
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"routing"
|
||||
],
|
||||
"main": "iron-location.html",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/iron-location.git"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/iron-location",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"promise-polyfill": "polymerlabs/promise-polyfill#^1.0.0",
|
||||
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
|
||||
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0",
|
||||
"paper-input": "polymerelements/paper-input#^1.0.0",
|
||||
"paper-slider": "polymerelements/paper-slider#^1.0.0",
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.0",
|
||||
"test-fixture": "polymerelements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"_release": "0.8.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v0.8.0",
|
||||
"commit": "9ed0d3f243a70545204ade98720d16b2ff71feb4"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/iron-location.git",
|
||||
"_target": "^0.8.0",
|
||||
"_originalSource": "PolymerElements/iron-location"
|
||||
}
|
1
dashboard-ui/bower_components/iron-location/.gitignore
vendored
Normal file
1
dashboard-ui/bower_components/iron-location/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
bower_components
|
25
dashboard-ui/bower_components/iron-location/.travis.yml
vendored
Normal file
25
dashboard-ui/bower_components/iron-location/.travis.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
language: node_js
|
||||
sudo: false
|
||||
node_js: stable
|
||||
addons:
|
||||
firefox: latest
|
||||
apt:
|
||||
sources:
|
||||
- google-chrome
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- google-chrome-stable
|
||||
- g++-4.8
|
||||
sauce_connect: true
|
||||
before_script:
|
||||
- npm install -g bower polylint web-component-tester
|
||||
- bower install
|
||||
- polylint
|
||||
script:
|
||||
- xvfb-run wct
|
||||
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"
|
||||
env:
|
||||
global:
|
||||
- secure: GQ+cUlta7BWa8Gq4YXrBStPzwRpHT2QG79T4pbDTz2Zs1RvT0GYQaEUksPQnsNCwnTF8ondXhUfMxHcC/r8p7YTCt2hSJSsKkx0lMertsjbKW38ZG28liaAN8msYGb9hnTs4qxhpVEX1pZtOI13RKBU85dw+jKbtxKDX/jVrMn42XCMhEmTeLxM4z8dW5nBu6LW6F3nwABQIUfdc/3OeIYG+2n+84zkXIsX1BFeejq28E6fYJAoMJgqfugLPgPu4IEVCWZJwYl2SgdXwxAcJ2auPph5GJ3DLd0fRRD1TZ94/u0A+eJcQ0OPiPu8hLpQNXOkCgAnO5jkpTCDERNQnB4nY8VfZeZdf1RLAB4VmxzOAbJwJcnqGrh89H6RhKKXyhcuFCgFACYfkzncBCs+co5KwVcwLq88cDOUbnmo3DlwQWpkfusvKy/ZrMrFrX1zycJWN4u8rDsIH4ELasSQh/J3OIa9l2mKfL/OEvqCmpv/ZLGlOVSvNLpr4U7vTVdZBP6C9rtwVXX7VzrClttiidHfoxztAMrNh2GBMjNH9n3FuWMoA/OSoxQGc7RreTsuzdniw3iJYUHIeG08R9bqRtSVA71AlQrbqUaHR+WM7rf7GUx6xG0uDop5vH0RDkE0Nld1W8XuVhHQUg3y3fd4AHJAQVmM7Zsfa3AY1gSr3hV0=
|
||||
- secure: He0JAbtg9jFzuEBRHQdFWHJ33uueY/9Hxq4NB5PCAI1Z9ebIiTs73ofdNy6e+ftBqlQnBuhoKLfIpuD8Qj2kSdLHQvg1s6ojvNDmAvau1ZINCJRgOSKbGC0TvCVx9rT9Kqc83eqKvKDzr/rcpaIArgMYJzBrSG0D2Kn4luUQnWkKfo1knn17ytJFCvzqQvPWZTIZ6beJ7MRKXRU093a4wYMsKIxQHH65T4Ypj+RBsgv6Xnidjb8qZbNsEwaeOwExfsh30WUo/hSygRi2CP3KSRSc/vsMgSrGpFghZpnhjeDJAGTiDzCTxpJkAkHXereJT4agsWErcgSrRTaxi5G6f18o56pRS+I61BC5DuGGwSL7hOHWSC8pGzkwVFyz31MB2ll0HO3iQHMmcSjY37+G7toEP/vJ/UHm6SZoQq36HGJea7Ycv/2mk4HAHcVEDxhYG42bXXflxevFeqAkVUI7SxSaQpQuZF76/4th4uKFmAHPvRVj5yx8OWil9Lt6cG8DIEZaxXdJVueGgiODmmul7lAd5osO/1UCg4CTy1OnmuSJj7ax9LBa6YY2+3uvnBfE7fNUVKmVmVhlLsF0QAdj0LaFoSU0eQFWdReYqBxEvc4gOT3AtEpaAvfZnL11Q6wVyI7kCHhTHrltA4WENPOSA2u7W//WsQfHX3gRdpIVIVI=
|
||||
- CXX=g++-4.8
|
77
dashboard-ui/bower_components/iron-location/CONTRIBUTING.md
vendored
Normal file
77
dashboard-ui/bower_components/iron-location/CONTRIBUTING.md
vendored
Normal file
|
@ -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!
|
36
dashboard-ui/bower_components/iron-location/bower.json
vendored
Normal file
36
dashboard-ui/bower_components/iron-location/bower.json
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "iron-location",
|
||||
"version": "0.8.0",
|
||||
"description": "Bidirectional data binding into the page's URL.",
|
||||
"private": true,
|
||||
"authors": [
|
||||
"The Polymer Authors"
|
||||
],
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"routing"
|
||||
],
|
||||
"main": "iron-location.html",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/iron-location.git"
|
||||
},
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"homepage": "https://github.com/PolymerElements/iron-location",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"promise-polyfill": "polymerlabs/promise-polyfill#^1.0.0",
|
||||
"iron-component-page": "polymerelements/iron-component-page#^1.0.0",
|
||||
"iron-flex-layout": "polymerelements/iron-flex-layout#^1.0.0",
|
||||
"paper-input": "polymerelements/paper-input#^1.0.0",
|
||||
"paper-slider": "polymerelements/paper-slider#^1.0.0",
|
||||
"paper-styles": "polymerelements/paper-styles#^1.0.0",
|
||||
"test-fixture": "polymerelements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "^4.0.0",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
}
|
||||
}
|
124
dashboard-ui/bower_components/iron-location/demo/index.html
vendored
Normal file
124
dashboard-ui/bower_components/iron-location/demo/index.html
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
<!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>iron-location</title>
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-location.html">
|
||||
<link rel="import" href="../../paper-styles/typography.html">
|
||||
<link rel="import" href="../../iron-flex-layout/iron-flex-layout.html">
|
||||
<link rel="import" href="../../paper-input/paper-input.html">
|
||||
<link rel="import" href="../../paper-slider/paper-slider.html">
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<dom-module id="iron-location-demo">
|
||||
<template>
|
||||
<style>
|
||||
div.inputs {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.inputs, .history_entries {
|
||||
@apply(--layout-vertical);
|
||||
@apply(--layout-flex);
|
||||
padding: 20px;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.container {
|
||||
@apply(--layout-horizontal);
|
||||
}
|
||||
</style>
|
||||
<iron-location path="{{path}}" hash="{{hash}}" query="{{query}}"
|
||||
dwell-time="{{dwellTime}}">
|
||||
</iron-location>
|
||||
|
||||
<div class="container">
|
||||
<div class="inputs">
|
||||
<h3>URL</h3>
|
||||
<paper-input label="path" value="{{path}}" always-float-label>
|
||||
</paper-input>
|
||||
<paper-input label="hash" value="{{hash}}" always-float-label>
|
||||
</paper-input>
|
||||
<paper-input label='query' value='{{query}}' always-float-label>
|
||||
</paper-input>
|
||||
</div>
|
||||
<div class="history_entries">
|
||||
<h3>Dwell Time</h3>
|
||||
<p>
|
||||
iron-location won't add extraneous entries to the browser's history
|
||||
when changes come in quick succession.
|
||||
</p>
|
||||
<p>
|
||||
A new history entry will only be added if iron-location stays in
|
||||
the same state longer than dwellTime.
|
||||
</p>
|
||||
<div>
|
||||
<label>History added: </label>
|
||||
{{historyElementsAdded}} entries
|
||||
</div>
|
||||
<div>
|
||||
<label>Dwell time:</label>
|
||||
{{inSeconds(dwellTime)}}s
|
||||
</div>
|
||||
<paper-slider min="-1" max="5000" value="2000" step="100"
|
||||
immediate-value="{{dwellTime}}">
|
||||
</paper-slider>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
window.addEventListener('WebComponentsReady', function() {
|
||||
Polymer({
|
||||
is: 'iron-location-demo',
|
||||
properties: {
|
||||
historyElementsAdded: {
|
||||
type: Number
|
||||
}
|
||||
},
|
||||
observers: [
|
||||
'checkHistorySize(path, hash, query, startingHistoryLength)'
|
||||
],
|
||||
ready: function() {
|
||||
this.startingHistoryLength = window.history.length;
|
||||
},
|
||||
checkHistorySize: function() {
|
||||
this.historyElementsAdded =
|
||||
window.history.length - this.startingHistoryLength;
|
||||
},
|
||||
inSeconds: function(dwellTime) {
|
||||
if (dwellTime === -1) {
|
||||
return -1;
|
||||
}
|
||||
return (Math.round(dwellTime / 100) / 10)
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<iron-location-demo></iron-location-demo>
|
||||
</body>
|
||||
</html>
|
119
dashboard-ui/bower_components/iron-location/demo/iron-query-params.html
vendored
Normal file
119
dashboard-ui/bower_components/iron-location/demo/iron-query-params.html
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
<!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>iron-query-params</title>
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<link rel="import" href="../iron-query-params.html">
|
||||
<link rel="import" href="../../paper-styles/classes/typography.html">
|
||||
<link rel="import" href="../../iron-flex-layout/classes/iron-flex-layout.html">
|
||||
<link rel="import" href="../../paper-input/paper-input.html">
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<dom-module id='iron-query-params-demo'>
|
||||
<template>
|
||||
<style>
|
||||
div.inputs {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
label {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
}
|
||||
span.seconds {
|
||||
}
|
||||
[layout] {
|
||||
@apply(--layout);
|
||||
}
|
||||
[layout][horizontal] {
|
||||
@apply(--layout-horizontal);
|
||||
}
|
||||
[layout][horizontal] > div {
|
||||
padding: 20px;
|
||||
max-width: 500px;
|
||||
}
|
||||
[layout][vertical] {
|
||||
@apply(--layout-vertical);
|
||||
}
|
||||
[layout][flex] {
|
||||
@apply(--layout-flex);
|
||||
}
|
||||
h3 {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<iron-query-params
|
||||
params-string='{{paramString}}' params-object='{{params}}'>
|
||||
</iron-query-params>
|
||||
|
||||
<div layout horizontal>
|
||||
<div layout vertical flex class='inputs'>
|
||||
<paper-input label='params as string'
|
||||
value='{{paramString}}' always-float-label>
|
||||
</paper-input>
|
||||
<paper-input label='params as object' value='{{paramsString}}'
|
||||
invalid='{{paramsInvalid}}'
|
||||
error-message='Should be legal JSON'
|
||||
always-float-label>
|
||||
</paper-input>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
window.addEventListener('WebComponentsReady', function() {
|
||||
Polymer({
|
||||
is: 'iron-query-params-demo',
|
||||
properties: {
|
||||
paramsString: {
|
||||
observer: 'paramsStringChanged'
|
||||
},
|
||||
params: {
|
||||
observer: 'paramsChanged'
|
||||
},
|
||||
paramsInvalid: {
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
paramsStringChanged: function() {
|
||||
if (this.ignore) {
|
||||
return;
|
||||
}
|
||||
this.ignore = true;
|
||||
try {
|
||||
this.params = JSON.parse(this.paramsString);
|
||||
this.paramsInvalid = false;
|
||||
} catch(_) {
|
||||
this.paramsInvalid = true;
|
||||
}
|
||||
this.ignore = false;
|
||||
},
|
||||
paramsChanged: function() {
|
||||
if (this.ignore) {
|
||||
return;
|
||||
}
|
||||
this.ignore = true;
|
||||
this.paramsString = JSON.stringify(this.params);
|
||||
this.paramsInvalid = false;
|
||||
this.ignore = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<iron-query-params-demo></iron-query-params-demo>
|
||||
</body>
|
||||
</html>
|
27
dashboard-ui/bower_components/iron-location/index.html
vendored
Normal file
27
dashboard-ui/bower_components/iron-location/index.html
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!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>iron-location</title>
|
||||
<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>
|
301
dashboard-ui/bower_components/iron-location/iron-location.html
vendored
Normal file
301
dashboard-ui/bower_components/iron-location/iron-location.html
vendored
Normal file
|
@ -0,0 +1,301 @@
|
|||
<!--
|
||||
@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">
|
||||
|
||||
<!--
|
||||
|
||||
The `iron-location` element manages binding to and from the current URL.
|
||||
|
||||
iron-location is the first, and lowest level element in the Polymer team's
|
||||
routing system. This is a beta release of iron-location as we continue work
|
||||
on higher level elements, and as such iron-location may undergo breaking
|
||||
changes.
|
||||
|
||||
#### Properties
|
||||
|
||||
When the URL is: `/search?query=583#details` iron-location's properties will be:
|
||||
|
||||
- path: `'/search'`
|
||||
- query: `'query=583'`
|
||||
- hash: `'details'`
|
||||
|
||||
These bindings are bidirectional. Modifying them will in turn modify the URL.
|
||||
|
||||
iron-location is only active while it is attached to the document.
|
||||
|
||||
#### Links
|
||||
|
||||
While iron-location is active in the document it will intercept clicks on links
|
||||
within your site, updating the URL pushing the updated URL out through the
|
||||
databinding system. iron-location only intercepts clicks with the intent to
|
||||
open in the same window, so middle mouse clicks and ctrl/cmd clicks work fine.
|
||||
|
||||
You can customize this behavior with the `urlSpaceRegex`.
|
||||
|
||||
#### Dwell Time
|
||||
|
||||
iron-location protects against accidental history spamming by only adding
|
||||
entries to the user's history if the URL stays unchanged for `dwellTime`
|
||||
milliseconds.
|
||||
|
||||
@demo demo/index.html
|
||||
|
||||
-->
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
Polymer({
|
||||
is: 'iron-location',
|
||||
properties: {
|
||||
/**
|
||||
* The pathname component of the URL.
|
||||
*/
|
||||
path: {
|
||||
type: String,
|
||||
notify: true,
|
||||
value: function() {
|
||||
return window.location.pathname;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* The query string portion of the URL.
|
||||
*/
|
||||
query: {
|
||||
type: String,
|
||||
notify: true,
|
||||
value: function() {
|
||||
return window.location.search.slice(1);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* The hash component of the URL.
|
||||
*/
|
||||
hash: {
|
||||
type: String,
|
||||
notify: true,
|
||||
value: function() {
|
||||
return window.location.hash.slice(1);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* If the user was on a URL for less than `dwellTime` milliseconds, it
|
||||
* won't be added to the browser's history, but instead will be replaced
|
||||
* by the next entry.
|
||||
*
|
||||
* This is to prevent large numbers of entries from clogging up the user's
|
||||
* browser history. Disable by setting to a negative number.
|
||||
*/
|
||||
dwellTime: {
|
||||
type: Number,
|
||||
value: 2000
|
||||
},
|
||||
|
||||
/**
|
||||
* A regexp that defines the set of URLs that should be considered part
|
||||
* of this web app.
|
||||
*
|
||||
* Clicking on a link that matches this regex won't result in a full page
|
||||
* navigation, but will instead just update the URL state in place.
|
||||
*
|
||||
* This regexp is given everything after the origin in an absolute
|
||||
* URL. So to match just URLs that start with /search/ do:
|
||||
* url-space-regex="^/search/"
|
||||
*
|
||||
* @type {string|RegExp}
|
||||
*/
|
||||
urlSpaceRegex: {
|
||||
type: String,
|
||||
value: ''
|
||||
},
|
||||
|
||||
/**
|
||||
* urlSpaceRegex, but coerced into a regexp.
|
||||
*
|
||||
* @type {RegExp}
|
||||
*/
|
||||
_urlSpaceRegExp: {
|
||||
computed: '_makeRegExp(urlSpaceRegex)'
|
||||
},
|
||||
|
||||
_lastChangedAtAt: {
|
||||
type: Number,
|
||||
value: -Infinity
|
||||
},
|
||||
|
||||
_initialized: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
}
|
||||
},
|
||||
hostAttributes: {
|
||||
hidden: true
|
||||
},
|
||||
observers: [
|
||||
'_updateUrl(path, query, hash)'
|
||||
],
|
||||
attached: function() {
|
||||
this.listen(window, 'hashchange', '_hashChanged');
|
||||
this.listen(window, 'location-changed', '_urlChanged');
|
||||
this.listen(window, 'popstate', '_urlChanged');
|
||||
this.listen(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
|
||||
|
||||
this._urlChanged();
|
||||
this._initialized = true;
|
||||
},
|
||||
detached: function() {
|
||||
this.unlisten(window, 'hashchange', '_hashChanged');
|
||||
this.unlisten(window, 'location-changed', '_urlChanged');
|
||||
this.unlisten(window, 'popstate', '_urlChanged');
|
||||
this.unlisten(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
|
||||
this._initialized = false;
|
||||
},
|
||||
/**
|
||||
* @return {number} the number of milliseconds since some point in the
|
||||
* past. Only useful for comparing against other results from this
|
||||
* function.
|
||||
*/
|
||||
_now: function() {
|
||||
if (window.performance && window.performance.now) {
|
||||
return window.performance.now();
|
||||
}
|
||||
return new Date().getTime();
|
||||
},
|
||||
_hashChanged: function() {
|
||||
this.hash = window.location.hash.substring(1);
|
||||
},
|
||||
_urlChanged: function() {
|
||||
// We want to extract all info out of the updated URL before we
|
||||
// try to write anything back into it.
|
||||
//
|
||||
// i.e. without _dontUpdateUrl we'd overwrite the new path with the old
|
||||
// one when we set this.hash. Likewise for query.
|
||||
this._dontUpdateUrl = true;
|
||||
this._hashChanged();
|
||||
this.path = window.location.pathname;
|
||||
this.query = window.location.search.substring(1);
|
||||
this._dontUpdateUrl = false;
|
||||
this._updateUrl();
|
||||
},
|
||||
_getUrl: function() {
|
||||
var url = this.path;
|
||||
var query = this.query;
|
||||
if (query) {
|
||||
url += '?' + query;
|
||||
}
|
||||
if (this.hash) {
|
||||
url += '#' + this.hash;
|
||||
}
|
||||
return url;
|
||||
},
|
||||
_updateUrl: function() {
|
||||
if (this._dontUpdateUrl || !this._initialized) {
|
||||
return;
|
||||
}
|
||||
var newUrl = this._getUrl();
|
||||
var currentUrl = (
|
||||
window.location.pathname +
|
||||
window.location.search +
|
||||
window.location.hash
|
||||
);
|
||||
if (newUrl == currentUrl) {
|
||||
// nothing to do, the URL didn't change
|
||||
return;
|
||||
}
|
||||
var now = this._now();
|
||||
var shouldReplace =
|
||||
this._lastChangedAt + this.dwellTime > now;
|
||||
this._lastChangedAt = now;
|
||||
if (shouldReplace) {
|
||||
window.history.replaceState({}, '', newUrl);
|
||||
} else {
|
||||
window.history.pushState({}, '', newUrl);
|
||||
}
|
||||
this.fire('location-changed', {}, {node: window});
|
||||
},
|
||||
/**
|
||||
* A necessary evil so that links work as expected. Does its best to
|
||||
* bail out early if possible.
|
||||
*
|
||||
* @param {MouseEvent} event .
|
||||
*/
|
||||
_globalOnClick: function(event) {
|
||||
var href = this._getSameOriginLinkHref(event);
|
||||
if (!href) {
|
||||
return;
|
||||
}
|
||||
|
||||
window.history.pushState({}, '', href);
|
||||
this.fire('location-changed', {}, {node: window});
|
||||
event.preventDefault();
|
||||
},
|
||||
/**
|
||||
* Returns the absolute URL of the link (if any) that this click event
|
||||
* is clicking on, if we can and should override the resulting full
|
||||
* page navigation. Returns null otherwise.
|
||||
*
|
||||
* This method is separated away from _globalOnClick for testability,
|
||||
* as we can't test that a clicked link should have resulted in navigating
|
||||
* away from the test page.
|
||||
*
|
||||
* @param {MouseEvent} event .
|
||||
* @return {string?} .
|
||||
*/
|
||||
_getSameOriginLinkHref: function(event) {
|
||||
// We only care about left-clicks.
|
||||
if (event.button !== 0) {
|
||||
return null;
|
||||
}
|
||||
// We don't want modified clicks, where the intent is to open the page
|
||||
// in a new tab.
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
return null;
|
||||
}
|
||||
var eventPath = Polymer.dom(event).path;
|
||||
var href = null;
|
||||
for (var i = 0; i < eventPath.length; i++) {
|
||||
var element = eventPath[i];
|
||||
if (element.tagName === 'A' && element.href) {
|
||||
href = element.href;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If there's no link there's nothing to do.
|
||||
if (!href) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// It only makes sense for us to intercept same-origin navigations.
|
||||
// pushState/replaceState don't work with cross-origin links.
|
||||
var url;
|
||||
if (document.baseURI != null) {
|
||||
url = new URL(href, /** @type {string} */(document.baseURI));
|
||||
} else {
|
||||
url = new URL(href);
|
||||
}
|
||||
|
||||
if (url.origin !== window.location.origin) {
|
||||
return null;
|
||||
}
|
||||
var normalizedHref = url.pathname + url.search + url.hash;
|
||||
|
||||
// If we've been configured not to handle this url... don't handle it!
|
||||
if (this._urlSpaceRegExp &&
|
||||
!this._urlSpaceRegExp.test(normalizedHref)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return normalizedHref;
|
||||
},
|
||||
_makeRegExp: function(urlSpaceRegex) {
|
||||
return RegExp(urlSpaceRegex);
|
||||
}
|
||||
});
|
||||
</script>
|
83
dashboard-ui/bower_components/iron-location/iron-query-params.html
vendored
Normal file
83
dashboard-ui/bower_components/iron-location/iron-query-params.html
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
<!--
|
||||
@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">
|
||||
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
Polymer({
|
||||
is: 'iron-query-params',
|
||||
properties: {
|
||||
paramsString: {
|
||||
type: String,
|
||||
notify: true,
|
||||
observer: 'paramsStringChanged',
|
||||
},
|
||||
paramsObject: {
|
||||
type: Object,
|
||||
notify: true,
|
||||
value: function() {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
_dontReact: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
}
|
||||
},
|
||||
hostAttributes: {
|
||||
hidden: true
|
||||
},
|
||||
observers: [
|
||||
'paramsObjectChanged(paramsObject.*)'
|
||||
],
|
||||
paramsStringChanged: function() {
|
||||
this._dontReact = true;
|
||||
this.paramsObject = this._decodeParams(this.paramsString);
|
||||
this._dontReact = false;
|
||||
},
|
||||
paramsObjectChanged: function() {
|
||||
if (this._dontReact) {
|
||||
return;
|
||||
}
|
||||
this.paramsString = this._encodeParams(this.paramsObject);
|
||||
},
|
||||
_encodeParams: function(params) {
|
||||
var encodedParams = [];
|
||||
for (var key in params) {
|
||||
var value = params[key];
|
||||
if (value === '') {
|
||||
encodedParams.push(encodeURIComponent(key));
|
||||
} else if (value) {
|
||||
encodedParams.push(
|
||||
encodeURIComponent(key) +
|
||||
'=' +
|
||||
encodeURIComponent(value.toString())
|
||||
);
|
||||
}
|
||||
}
|
||||
return encodedParams.join('&');
|
||||
},
|
||||
_decodeParams: function(paramString) {
|
||||
var params = {};
|
||||
var paramList = (paramString || '').split('&');
|
||||
for (var i = 0; i < paramList.length; i++) {
|
||||
var param = paramList[i].split('=');
|
||||
if (param[0]) {
|
||||
params[decodeURIComponent(param[0])] =
|
||||
decodeURIComponent(param[1] || '');
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
});
|
||||
</script>
|
26
dashboard-ui/bower_components/iron-location/test/index.html
vendored
Normal file
26
dashboard-ui/bower_components/iron-location/test/index.html
vendored
Normal file
|
@ -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">
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WCT.loadSuites([
|
||||
'iron-location.html',
|
||||
'iron-query-params.html',
|
||||
'initialization-tests.html'
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
277
dashboard-ui/bower_components/iron-location/test/initialization-cases.html
vendored
Normal file
277
dashboard-ui/bower_components/iron-location/test/initialization-cases.html
vendored
Normal file
|
@ -0,0 +1,277 @@
|
|||
<!--
|
||||
@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='../iron-location.html'>
|
||||
<link rel='import' href='../../polymer/polymer.html'>
|
||||
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'default-value',
|
||||
properties: {
|
||||
val: {
|
||||
type: String,
|
||||
notify: true,
|
||||
value: 'default-value'
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Polymer({
|
||||
is: 'on-attached',
|
||||
properties: {
|
||||
val: {
|
||||
type: String,
|
||||
notify: true,
|
||||
value: 'on-attached-default-value'
|
||||
}
|
||||
},
|
||||
attached: function() {
|
||||
if (this.val === 'on-attached-default-value') {
|
||||
this.val = 'on-attached';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Polymer({
|
||||
is: 'on-ready',
|
||||
properties: {
|
||||
val: {
|
||||
type: String,
|
||||
notify: true,
|
||||
value: 'on-ready-default-value'
|
||||
}
|
||||
},
|
||||
ready: function() {
|
||||
this.val = 'on-ready';
|
||||
}
|
||||
});
|
||||
|
||||
Polymer({
|
||||
is: 'on-timeout',
|
||||
properties: {
|
||||
val: {
|
||||
type: String,
|
||||
notify: true,
|
||||
value: 'on-timeout-default-value'
|
||||
}
|
||||
},
|
||||
attached: function() {
|
||||
setTimeout(function() {
|
||||
this.val = 'on-timeout';
|
||||
}.bind(this), 10);
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<dom-module id='default-before'>
|
||||
<template>
|
||||
<default-value value='{{val}}'></default-value>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
|
||||
</template>
|
||||
<script>Polymer({is: 'default-before', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='attached-before'>
|
||||
<template>
|
||||
<on-attached val='{{val}}'></on-attached>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</template>
|
||||
<script>Polymer({is: 'attached-before', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='ready-before'>
|
||||
<template>
|
||||
<on-ready val='{{val}}'></on-ready>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</template>
|
||||
<script>Polymer({is: 'ready-before', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='timeout-before'>
|
||||
<template>
|
||||
<on-timeout val='{{val}}'></on-timeout>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</template>
|
||||
<script>Polymer({is: 'timeout-before', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
|
||||
<dom-module id='default-after'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
<default-value value='{{val}}'></default-value>
|
||||
</template>
|
||||
<script>Polymer({is: 'default-after', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='attached-after'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
<on-attached val='{{val}}'></on-attached>
|
||||
</template>
|
||||
<script>Polymer({is: 'attached-after', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='ready-after'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
<on-ready val='{{val}}'></on-ready>
|
||||
</template>
|
||||
<script>Polymer({is: 'ready-after', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='timeout-after'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
<on-timeout val='{{val}}'></on-timeout>
|
||||
</template>
|
||||
<script>Polymer({is: 'timeout-after', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
|
||||
<dom-module id='default-below'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'>
|
||||
<default-value value='{{val}}'></default-value>
|
||||
</iron-location>
|
||||
</template>
|
||||
<script>Polymer({is: 'default-below', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='attached-below'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'>
|
||||
<on-attached val='{{val}}'></on-attached>
|
||||
</iron-location>
|
||||
</template>
|
||||
<script>Polymer({is: 'attached-below', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='ready-below'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'>
|
||||
<on-ready val='{{val}}'></on-ready>
|
||||
</iron-location>
|
||||
</template>
|
||||
<script>Polymer({is: 'ready-below', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='timeout-below'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'>
|
||||
<on-timeout val='{{val}}'></on-timeout>
|
||||
</iron-location>
|
||||
</template>
|
||||
<script>Polymer({is: 'timeout-below', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
|
||||
<dom-module id='default-above'>
|
||||
<template>
|
||||
<default-value value='{{val}}'>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</default-value>
|
||||
</template>
|
||||
<script>Polymer({is: 'default-above', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='attached-above'>
|
||||
<template>
|
||||
<on-attached val='{{val}}'>
|
||||
<iron-location query='{{val}}'>
|
||||
</iron-location>
|
||||
</on-attached>
|
||||
</template>
|
||||
<script>Polymer({is: 'attached-above', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='ready-above'>
|
||||
<template>
|
||||
<on-ready val='{{val}}'>
|
||||
<iron-location query='{{val}}'>
|
||||
</iron-location>
|
||||
</on-ready>
|
||||
</template>
|
||||
<script>Polymer({is: 'ready-above', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='timeout-above'>
|
||||
<template>
|
||||
<on-timeout val='{{val}}'>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</on-timeout>
|
||||
</template>
|
||||
<script>Polymer({is: 'timeout-above', properties: {val: {type: String}}});</script>
|
||||
</dom-module>
|
||||
|
||||
|
||||
<dom-module id='default-container'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'default-container',
|
||||
properties: {val: {type: String, value: 'default-container-val'}}
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='attached-container'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'attached-container',
|
||||
properties: {val: {type: String, value: 'container-attached-default-val'}},
|
||||
attached: function() {
|
||||
if (this.val === 'container-attached-default-val') {
|
||||
this.val = 'attached-container-val';
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='ready-container'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'ready-container', properties: {val: {type: String}},
|
||||
ready: function() {
|
||||
this.val = 'ready-container-val';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
||||
|
||||
<dom-module id='timeout-container'>
|
||||
<template>
|
||||
<iron-location query='{{val}}'></iron-location>
|
||||
</template>
|
||||
<script>Polymer({
|
||||
is: 'timeout-container',
|
||||
properties: {
|
||||
val: {
|
||||
type: String,
|
||||
notify: true
|
||||
}
|
||||
},
|
||||
attached: function() {
|
||||
setTimeout(function() {
|
||||
this.val = 'on-timeout';
|
||||
}.bind(this), 10);
|
||||
}
|
||||
});</script>
|
||||
</dom-module>
|
61
dashboard-ui/bower_components/iron-location/test/initialization-iframe.html
vendored
Normal file
61
dashboard-ui/bower_components/iron-location/test/initialization-iframe.html
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<!--
|
||||
@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
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Base source for injecting into an iframe for tests</title>
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<link rel='import' href='./initialization-cases.html'>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
window.addEventListener("message", messageReceived, false);
|
||||
|
||||
window.addEventListener('WebComponentsReady', function() {
|
||||
window.parent.postMessage({
|
||||
'type': 'ready'
|
||||
}, '*');
|
||||
});
|
||||
|
||||
var appendBodyReceived = false;
|
||||
function messageReceived(msg) {
|
||||
if (!msg.data) {
|
||||
console.error('got invalid msg?');
|
||||
}
|
||||
// the parent can (at any time) ask for our URL.
|
||||
if (msg.data.type === 'urlQuery') {
|
||||
msg.source.postMessage({
|
||||
'type': 'urlQueryResponse',
|
||||
'href': window.location.href,
|
||||
'pathname': window.location.pathname,
|
||||
'hash': window.location.hash,
|
||||
'search': window.location.search
|
||||
}, '*');
|
||||
} else if (msg.data.type === 'appendBody') {
|
||||
if (appendBodyReceived) {
|
||||
throw new Error('should only receive at most one appendBody call');
|
||||
}
|
||||
var element = document.createElement(msg.data.tagName);
|
||||
document.body.appendChild(element);
|
||||
appendBodyReceived = true;
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('error', function(e) {
|
||||
window.parent.postMessage({
|
||||
'type': 'error',
|
||||
'error': e.message
|
||||
}, '*');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
145
dashboard-ui/bower_components/iron-location/test/initialization-tests.html
vendored
Normal file
145
dashboard-ui/bower_components/iron-location/test/initialization-tests.html
vendored
Normal file
|
@ -0,0 +1,145 @@
|
|||
<!--
|
||||
@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
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../iron-location.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
function getIframe() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var iframe = document.createElement('iframe');
|
||||
var result = getMessageMatching(iframe, function(message) {
|
||||
return message.type === 'ready';
|
||||
});
|
||||
iframe.src = './initialization-iframe.html';
|
||||
document.body.appendChild(iframe);
|
||||
iframe.addEventListener('error', reject);
|
||||
result.then(function() {resolve(iframe)}, reject);
|
||||
});
|
||||
}
|
||||
|
||||
function onMessage(iframe, callback) {
|
||||
var f = function(event) {
|
||||
if (event.source === iframe.contentWindow) {
|
||||
callback(event.data);
|
||||
}
|
||||
};
|
||||
window.addEventListener('message', f, false);
|
||||
return function() {
|
||||
window.removeEventListener('message', f);
|
||||
}
|
||||
}
|
||||
|
||||
function getMessageMatching(iframe, predicate) {
|
||||
var revoke = function() {};
|
||||
var result = new Promise(function(resolve, reject) {
|
||||
revoke = onMessage(iframe, function(message) {
|
||||
if (predicate(message)) {
|
||||
resolve(message);
|
||||
}
|
||||
});
|
||||
});
|
||||
result.then(revoke, revoke);
|
||||
return result;
|
||||
}
|
||||
|
||||
function getUrl(iframe) {
|
||||
var result = getMessageMatching(iframe, function(message) {
|
||||
return message.type === 'urlQueryResponse';
|
||||
})
|
||||
var revoke = function() {};
|
||||
var result = new Promise(function(resolve, reject) {
|
||||
revoke = onMessage(iframe, resolve);
|
||||
});
|
||||
result.then(revoke, revoke);
|
||||
iframe.contentWindow.postMessage({type: 'urlQuery'}, '*');
|
||||
return result;
|
||||
}
|
||||
|
||||
function timePasses(ms) {
|
||||
return new Promise(function(resolve) {
|
||||
window.setTimeout(function() {
|
||||
resolve();
|
||||
}, ms);
|
||||
});
|
||||
}
|
||||
|
||||
suite('<iron-location>\'s initialization', function() {
|
||||
var iframe;
|
||||
var error;
|
||||
setup(function() {
|
||||
return getIframe().then(function(i) {
|
||||
iframe = i;
|
||||
function isError(m) {return m.type === 'error'}
|
||||
getMessageMatching(iframe, isError).then(function(m) {
|
||||
error = m.error;
|
||||
});
|
||||
});
|
||||
});
|
||||
teardown(function() {
|
||||
if (iframe) {
|
||||
document.body.removeChild(iframe);
|
||||
}
|
||||
var e = error;
|
||||
iframe = null;
|
||||
error = null;
|
||||
if (e) {
|
||||
throw new Error('Error message from contained iframe: ' + e);
|
||||
}
|
||||
});
|
||||
var cases = [
|
||||
'default-before', 'attached-before', 'ready-before',
|
||||
'default-after', 'attached-after', 'ready-after',
|
||||
'default-below', 'attached-below', 'ready-below',
|
||||
'default-above', 'attached-above', 'ready-above',
|
||||
'default-container', 'attached-container', 'ready-container'
|
||||
];
|
||||
cases.forEach(function(caseName) {
|
||||
test('the url takes priority in ' + caseName + ' initialization', function() {
|
||||
return getUrl(iframe).then(function(url) {
|
||||
expect(url.search).to.be.eq('');
|
||||
iframe.contentWindow.postMessage({type: 'appendBody', tagName: caseName}, '*');
|
||||
return timePasses(10).then(function() {return getUrl(iframe)});
|
||||
}).then(function(url) {
|
||||
expect(url.search).to.be.eq('');
|
||||
});
|
||||
});
|
||||
});
|
||||
var expectedFailureCases = ['timeout-before', 'timeout-after', 'timeout-below', 'timeout-above', 'timeout-container'];
|
||||
expectedFailureCases.forEach(function(caseName) {
|
||||
test('the url does not take priority in ' + caseName + ' initialization', function() {
|
||||
return getUrl(iframe).then(function(url) {
|
||||
expect(url.search).to.be.eq('');
|
||||
iframe.contentWindow.postMessage({type: 'appendBody', tagName: caseName}, '*');
|
||||
return timePasses(60).then(function() {return getUrl(iframe)});
|
||||
}).then(function(url) {
|
||||
expect(url.search).to.be.eq('?on-timeout');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
140
dashboard-ui/bower_components/iron-location/test/iron-location.html
vendored
Normal file
140
dashboard-ui/bower_components/iron-location/test/iron-location.html
vendored
Normal file
|
@ -0,0 +1,140 @@
|
|||
<!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>iron-location</title>
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
|
||||
<link rel="import" href="../iron-location.html">
|
||||
</head>
|
||||
<body>
|
||||
<test-fixture id='Solo'>
|
||||
<template>
|
||||
<iron-location></iron-location>
|
||||
</template>
|
||||
</test-fixture>
|
||||
<test-fixture id='Together'>
|
||||
<template>
|
||||
<div>
|
||||
<iron-location id='one'></iron-location>
|
||||
<iron-location id='two'></iron-location>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
function timePasses(ms) {
|
||||
return new Promise(function(resolve) {
|
||||
window.setTimeout(function() {
|
||||
resolve();
|
||||
}, ms);
|
||||
});
|
||||
}
|
||||
|
||||
suite('<iron-location>', function () {
|
||||
var initialUrl;
|
||||
setup(function() {
|
||||
initialUrl = window.location.href;
|
||||
});
|
||||
teardown(function(){
|
||||
window.history.replaceState({}, '', initialUrl);
|
||||
});
|
||||
|
||||
suite('when used solo', function() {
|
||||
var urlElem;
|
||||
setup(function() {
|
||||
urlElem = fixture('Solo');
|
||||
});
|
||||
test('basic functionality with #hash urls', function() {
|
||||
// Initialized to the window location's hash.
|
||||
expect(window.location.hash).to.be.equal(urlElem.hash);
|
||||
|
||||
// Changing the urlElem's hash changes the URL
|
||||
urlElem.hash = '/lol/ok';
|
||||
expect(window.location.hash).to.be.equal('#/lol/ok');
|
||||
|
||||
// Changing the hash via normal means changes the urlElem.
|
||||
var anchor = document.createElement('a');
|
||||
anchor.href = '#/wat';
|
||||
document.body.appendChild(anchor);
|
||||
anchor.click();
|
||||
// In IE10 it appears that the hashchange event is asynchronous.
|
||||
return timePasses(10).then(function() {
|
||||
expect(urlElem.hash).to.be.equal('/wat');
|
||||
});
|
||||
});
|
||||
test('basic functionality with paths', function() {
|
||||
// Initialized to the window location's path.
|
||||
expect(window.location.pathname).to.be.equal(urlElem.path);
|
||||
|
||||
// Changing the urlElem's path changes the URL
|
||||
urlElem.path = '/foo/bar';
|
||||
expect(window.location.pathname).to.be.equal('/foo/bar');
|
||||
|
||||
// Changing the path and sending a custom event on the window changes
|
||||
// the urlElem.
|
||||
window.history.replaceState({}, '', '/baz')
|
||||
window.dispatchEvent(new CustomEvent('location-changed'));
|
||||
expect(urlElem.path).to.be.equal('/baz');
|
||||
});
|
||||
test('basic functionality with ?key=value params', function() {
|
||||
// Initialized to the window location's params.
|
||||
expect(urlElem.query).to.be.eq('');
|
||||
|
||||
// Changing location.search and sending a custom event on the window
|
||||
// changes the urlElem.
|
||||
window.history.replaceState({}, '', '/?greeting=hello&target=world');
|
||||
window.dispatchEvent(new CustomEvent('location-changed'));
|
||||
expect(urlElem.query).to.be.equal('greeting=hello&target=world');
|
||||
|
||||
// Changing the urlElem's query changes the URL.
|
||||
urlElem.query = 'greeting=hello&target=world&another=key';
|
||||
expect(window.location.search).to.be.equal(
|
||||
'?greeting=hello&target=world&another=key');
|
||||
});
|
||||
});
|
||||
suite('when used with other iron-location elements', function() {
|
||||
var otherUrlElem;
|
||||
var urlElem;
|
||||
setup(function() {
|
||||
var elems = fixture('Together');
|
||||
urlElem = elems.querySelector('#one');
|
||||
otherUrlElem = elems.querySelector('#two');
|
||||
});
|
||||
function assertHaveSameUrls(urlElemOne, urlElemTwo) {
|
||||
expect(urlElemOne.path).to.be.equal(urlElemTwo.path);
|
||||
expect(urlElemOne.hash).to.be.equal(urlElemTwo.hash);
|
||||
expect(urlElemOne.query).to.be.equal(urlElemTwo.query);
|
||||
}
|
||||
test('coordinate their changes (by firing events on window)', function() {
|
||||
assertHaveSameUrls(urlElem, otherUrlElem);
|
||||
|
||||
urlElem.path = '/a/b/c';
|
||||
assertHaveSameUrls(urlElem, otherUrlElem);
|
||||
|
||||
otherUrlElem.query = 'alsdkjflaksjfd=alksjfdlkajsdfl';
|
||||
assertHaveSameUrls(urlElem, otherUrlElem);
|
||||
|
||||
urlElem.hash = 'lkjljifosjkldfjlksjfldsjf';
|
||||
assertHaveSameUrls(urlElem, otherUrlElem);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
96
dashboard-ui/bower_components/iron-location/test/iron-query-params.html
vendored
Normal file
96
dashboard-ui/bower_components/iron-location/test/iron-query-params.html
vendored
Normal file
|
@ -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>iron-location</title>
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
|
||||
<link rel="import" href="../../polymer/polymer.html">
|
||||
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
|
||||
<link rel="import" href="../iron-query-params.html">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<test-fixture id="BasicQueryParams">
|
||||
<template>
|
||||
<iron-query-params></iron-query-params>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
suite('<iron-query-params>', function () {
|
||||
|
||||
var paramsElem;
|
||||
setup(function() {
|
||||
paramsElem = fixture('BasicQueryParams');
|
||||
});
|
||||
|
||||
test('basic functionality with ?key=value params', function() {
|
||||
// Check initialization
|
||||
expect(paramsElem.paramsString).to.be.eq('');
|
||||
expect(paramsElem.paramsObject).to.deep.eq({});
|
||||
|
||||
// Check the mapping from paramsString to paramsObject.
|
||||
paramsElem.paramsString = 'greeting=hello&target=world';
|
||||
expect(paramsElem.paramsObject).to.deep.equal(
|
||||
{greeting: 'hello', target: 'world'});
|
||||
|
||||
// Check the mapping from paramsObject back to paramsString.
|
||||
paramsElem.set('paramsObject.another', 'key');
|
||||
expect(paramsElem.paramsString).to.be.equal(
|
||||
'greeting=hello&target=world&another=key');
|
||||
});
|
||||
test('encoding of params', function() {
|
||||
var mappings = [
|
||||
{
|
||||
string: 'a=b',
|
||||
object: {'a': 'b'}
|
||||
},
|
||||
{
|
||||
string: 'debug&ok',
|
||||
object: {'debug': '', 'ok': ''}
|
||||
},
|
||||
{
|
||||
string: 'monster%20kid%3A=%F0%9F%98%BF',
|
||||
object: {'monster kid:': '😿'}
|
||||
},
|
||||
{
|
||||
string: 'yes%2C%20ok%3F%20what%20is%20up%20with%20%CB%9Athiiis%CB%9A=%E2%98%83',
|
||||
object: {'yes, ok? what is up with ˚thiiis˚': '☃'}
|
||||
},
|
||||
];
|
||||
|
||||
mappings.forEach(function(mapping) {
|
||||
// Clear
|
||||
paramsElem.paramsObject = {};
|
||||
expect(paramsElem.paramsString).to.be.equal('');
|
||||
|
||||
// Test going from string to object
|
||||
paramsElem.paramsString = mapping.string;
|
||||
expect(paramsElem.paramsObject).to.deep.equal(mapping.object);
|
||||
|
||||
// Clear again.
|
||||
paramsElem.paramsObject = {};
|
||||
expect(paramsElem.paramsString).to.be.equal('');
|
||||
|
||||
// Test going from object to string
|
||||
paramsElem.paramsObject = mapping.object;
|
||||
expect(paramsElem.paramsString).to.be.equal(mapping.string);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
|
@ -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"
|
||||
}
|
|
@ -34,14 +34,14 @@
|
|||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"ignore": [],
|
||||
"homepage": "https://github.com/PolymerElements/paper-icon-button",
|
||||
"homepage": "https://github.com/polymerelements/paper-icon-button",
|
||||
"_release": "1.0.7",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.7",
|
||||
"commit": "7623d73efeb6e2e88e2abdb5e4d00641d39e400f"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-icon-button.git",
|
||||
"_source": "git://github.com/polymerelements/paper-icon-button.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/paper-icon-button"
|
||||
"_originalSource": "polymerelements/paper-icon-button"
|
||||
}
|
|
@ -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