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

update components

This commit is contained in:
Luke Pulverenti 2016-04-22 12:09:08 -04:00
parent e1d75fd9c2
commit aaeb444675
22 changed files with 253 additions and 90 deletions

View file

@ -1,6 +1,6 @@
{
"name": "iron-location",
"version": "0.8.1",
"version": "0.8.2",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [
@ -11,7 +11,10 @@
"polymer",
"routing"
],
"main": "iron-location.html",
"main": [
"iron-location.html",
"iron-query-params.html"
],
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-location.git"
@ -31,13 +34,14 @@
"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"
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.3"
},
"_release": "0.8.1",
"_release": "0.8.2",
"_resolution": {
"type": "version",
"tag": "v0.8.1",
"commit": "fe42515f03ff4b3397dedf1c0810f1667f460172"
"tag": "v0.8.2",
"commit": "9ab0b3bf4b30e00d1f80dcb1cf9e00bd17cce4a5"
},
"_source": "git://github.com/PolymerElements/iron-location.git",
"_target": "^0.8.0",

View file

@ -1,15 +1,13 @@
language: node_js
sudo: false
sudo: required
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
@ -22,4 +20,4 @@ env:
global:
- secure: GQ+cUlta7BWa8Gq4YXrBStPzwRpHT2QG79T4pbDTz2Zs1RvT0GYQaEUksPQnsNCwnTF8ondXhUfMxHcC/r8p7YTCt2hSJSsKkx0lMertsjbKW38ZG28liaAN8msYGb9hnTs4qxhpVEX1pZtOI13RKBU85dw+jKbtxKDX/jVrMn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uSJj7ax9LBa6YY2+3uvnBfE7fNUVKmVmVhlLsF0QAdj0LaFoSU0eQFWdReYqBxEvc4gOT3AtEpaAvfZnL11Q6wVyI7kCHhTHrltA4WENPOSA2u7W//WsQfHX3gRdpIVIVI=
- CXX=g++-4.8
dist: trusty

View file

@ -9,7 +9,7 @@ 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
jsbin=https://jsbin.com/lebawa/edit?html,output
-->
# Polymer Elements
## Guide for Contributors

View file

@ -1,6 +1,6 @@
{
"name": "iron-location",
"version": "0.8.1",
"version": "0.8.2",
"description": "Bidirectional data binding into the page's URL.",
"private": true,
"authors": [
@ -11,7 +11,10 @@
"polymer",
"routing"
],
"main": "iron-location.html",
"main": [
"iron-location.html",
"iron-query-params.html"
],
"repository": {
"type": "git",
"url": "git://github.com/PolymerElements/iron-location.git"
@ -31,6 +34,7 @@
"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"
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0",
"iron-demo-helpers": "PolymerElements/iron-demo-helpers#^1.2.3"
}
}

View file

@ -20,9 +20,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<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="import" href="../../iron-demo-helpers/url-bar.html">
<link rel="stylesheet" href="../../paper-styles/demo.css">
</head>
<body>
<url-bar></url-bar>
<dom-module id="iron-location-demo">
<template>

View file

@ -147,8 +147,8 @@ milliseconds.
this.listen(window, 'popstate', '_urlChanged');
this.listen(/** @type {!HTMLBodyElement} */(document.body), 'click', '_globalOnClick');
this._urlChanged();
this._initialized = true;
this._urlChanged();
},
detached: function() {
this.unlisten(window, 'hashchange', '_hashChanged');
@ -209,14 +209,17 @@ milliseconds.
// nothing to do, the URL didn't change
return;
}
// Need to use a full URL in case the containing page has a base URI.
var fullNewUrl = new URL(
newUrl, window.location.protocol + '//' + window.location.host).href;
var now = this._now();
var shouldReplace =
this._lastChangedAt + this.dwellTime > now;
this._lastChangedAt = now;
if (shouldReplace) {
window.history.replaceState({}, '', newUrl);
window.history.replaceState({}, '', fullNewUrl);
} else {
window.history.pushState({}, '', newUrl);
window.history.pushState({}, '', fullNewUrl);
}
this.fire('location-changed', {}, {node: window});
},
@ -231,7 +234,6 @@ milliseconds.
if (!href) {
return;
}
window.history.pushState({}, '', href);
this.fire('location-changed', {}, {node: window});
event.preventDefault();
@ -304,8 +306,10 @@ milliseconds.
!this._urlSpaceRegExp.test(normalizedHref)) {
return null;
}
return normalizedHref;
// Need to use a full URL in case the containing page has a base URI.
var fullNormalizedHref = new URL(
normalizedHref, window.location.href).href;
return fullNormalizedHref;
},
_makeRegExp: function(urlSpaceRegex) {
return RegExp(urlSpaceRegex);

View file

@ -18,6 +18,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../polymer/polymer.html">
<link rel="import" href="../../promise-polyfill/promise-polyfill.html">
<link rel="import" href="../iron-location.html">
<link rel="import" href="./redirection.html">
</head>
<body>
<test-fixture id='Solo'>
@ -33,7 +34,21 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</div>
</template>
</test-fixture>
<test-fixture id='RedirectHash'>
<template>
<redirect-hash></redirect-hash>
</template>
</test-fixture>
<test-fixture id='RedirectPath'>
<template>
<redirect-path></redirect-path>
</template>
</test-fixture>
<test-fixture id='RedirectQuery'>
<template>
<redirect-query></redirect-query>
</template>
</test-fixture>
<script>
'use strict';
@ -46,15 +61,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
}
suite('<iron-location>', function () {
var initialUrl;
setup(function() {
initialUrl = window.location.href;
});
teardown(function(){
window.history.replaceState({}, '', initialUrl);
});
// A window.history.replaceState wrapper that's smart about baseURI.
function replaceState(url) {
window.history.replaceState(
{}, '', window.location.protocol + '//' + window.location.host + url);
}
/**
* We run the iron location tests with a couple different page configurations
* (e.g. with and withoug a base URI), so we define the test set as a function
* that we call in each of these configurations.
*/
function ironLocationTests() {
suite('when used solo', function() {
var urlElem;
setup(function() {
@ -70,7 +88,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// Changing the hash via normal means changes the urlElem.
var anchor = document.createElement('a');
anchor.href = '#/wat';
var base =
window.location.protocol + '//' + window.location.host +
window.location.pathname;
anchor.href = base + '#/wat';
document.body.appendChild(anchor);
anchor.click();
// In IE10 it appears that the hashchange event is asynchronous.
@ -88,17 +109,26 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// Changing the path and sending a custom event on the window changes
// the urlElem.
window.history.replaceState({}, '', '/baz')
replaceState('/baz');
window.dispatchEvent(new CustomEvent('location-changed'));
expect(urlElem.path).to.be.equal('/baz');
});
test('assigning to a relative path URL', function() {
urlElem.path = '/foo/bar';
expect(window.location.pathname).to.be.equal('/foo/bar');
// A relative path is treated as an absolute one, just with a
// missing leading slash.
urlElem.path = 'baz';
expect(window.location.pathname).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');
replaceState('/?greeting=hello&target=world');
window.dispatchEvent(new CustomEvent('location-changed'));
expect(urlElem.query).to.be.equal('greeting=hello&target=world');
@ -134,6 +164,67 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
assertHaveSameUrls(urlElem, otherUrlElem);
});
});
suite('supports doing synchronous redirection', function() {
test('of the hash portion of the URL', function() {
expect(window.location.hash).to.be.equal('');
var redirector = fixture('RedirectHash');
expect(window.location.hash).to.be.equal('#redirectedTo');
expect(redirector.hash).to.be.equal('redirectedTo');
redirector.hash = 'newHash';
expect(window.location.hash).to.be.equal('#redirectedTo');
expect(redirector.hash).to.be.equal('redirectedTo');
});
test('of the path portion of the URL', function() {
expect(window.location.pathname).to.not.be.equal('/redirectedTo');
var redirector = fixture('RedirectPath');
expect(window.location.pathname).to.be.equal('/redirectedTo');
expect(redirector.path).to.be.equal('/redirectedTo');
redirector.path = '/newPath';
expect(window.location.pathname).to.be.equal('/redirectedTo');
expect(redirector.path).to.be.equal('/redirectedTo');
});
test('of the query portion of the URL', function() {
expect(window.location.search).to.be.equal('');
var redirector = fixture('RedirectQuery');
expect(window.location.search).to.be.equal('?redirectedTo');
expect(redirector.query).to.be.equal('redirectedTo');
redirector.query = 'newQuery';
expect(window.location.search).to.be.equal('?redirectedTo');
expect(redirector.query).to.be.equal('redirectedTo');
});
});
}
suite('<iron-location>', function () {
var initialUrl;
setup(function() {
initialUrl = window.location.href;
});
teardown(function(){
window.history.replaceState({}, '', initialUrl);
});
ironLocationTests();
suite('with a base URI', function() {
var baseElem;
setup(function() {
expect(document.baseURI).to.be.equal(window.location.href);
baseElem = document.createElement('base');
var href = 'https://example.com/i/dont/exist/obviously'
baseElem.href = href;
document.head.appendChild(baseElem);
expect(document.baseURI).to.be.equal(href);
});
teardown(function() {
document.head.removeChild(baseElem);
});
ironLocationTests();
});
});
</script>