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

update components

Conflicts:
	MediaBrowser.WebDashboard/dashboard-ui/bower_components/emby-webcomponents/.bower.json
This commit is contained in:
Luke Pulverenti 2016-01-29 21:43:11 -05:00
parent d3f40bd6d9
commit 0c696294ae
42 changed files with 1514 additions and 361 deletions

View file

@ -1,6 +1,6 @@
{
"name": "paper-dialog-behavior",
"version": "1.1.0",
"version": "1.1.1",
"description": "Implements a behavior used for material design dialogs",
"authors": "The Polymer Authors",
"keywords": [
@ -21,7 +21,7 @@
"ignore": [],
"dependencies": {
"iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
"paper-styles": "PolymerElements/paper-styles#^1.1.0",
"polymer": "Polymer/polymer#^1.1.0"
},
"devDependencies": {
@ -29,14 +29,14 @@
"paper-button": "PolymerElements/paper-button#^1.0.0",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"_release": "1.1.0",
"_release": "1.1.1",
"_resolution": {
"type": "version",
"tag": "v1.1.0",
"commit": "e41d36a798df2ee2f9f49fb27dd7712e55366595"
"tag": "v1.1.1",
"commit": "5831039e9f878c63478064abed115c98992b5504"
},
"_source": "git://github.com/PolymerElements/paper-dialog-behavior.git",
"_target": "^1.0.0",

View file

@ -1,28 +1,26 @@
language: node_js
sudo: false
matrix:
include:
- node_js: stable
script: xvfb-run wct
addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
- node_js: node
script:
- |
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
wct -s 'default'
fi
before_script:
- npm install web-component-tester
- npm install bower
- export PATH=$PWD/node_modules/.bin:$PATH
- bower install
- npm install -g bower polylint web-component-tester
- bower install
- polylint
env:
global:
- secure: ZBrrZGA8OWY95x8yHSsKUNrQfowhRe/s/pMZhHgnoppnZ1+bDfpoms+ggOdvH0TgURAAdF+1Wq1mTCgNp0FYLJ3Oe34XseDIxiA3wXSQO/E2m4Cfj/w4fRvaSy8ikdz5urQJET33SjDKdggm1FmWmnt6vSVgW/mg8M7AW2KWDcE=
- secure: P5UKkTar39Q1k0VwtF5LhOphqNiW3r+DSnN1vRNA4oKZPrt6l3dJE1hpA9+1x1m6SryG856lLekPM6/fVZuC7nyDKFLz4vU/EWhiGdyWN1lHhE2MDh281TsCtzK56S0uJxdmlIpSiWTFWIrrEiiewN2b8dXy3FSPfy0Fo1sGn54=
- secure: ZBrrZGA8OWY95x8yHSsKUNrQfowhRe/s/pMZhHgnoppnZ1+bDfpoms+ggOdvH0TgURAAdF+1Wq1mTCgNp0FYLJ3Oe34XseDIxiA3wXSQO/E2m4Cfj/w4fRvaSy8ikdz5urQJET33SjDKdggm1FmWmnt6vSVgW/mg8M7AW2KWDcE=
- secure: P5UKkTar39Q1k0VwtF5LhOphqNiW3r+DSnN1vRNA4oKZPrt6l3dJE1hpA9+1x1m6SryG856lLekPM6/fVZuC7nyDKFLz4vU/EWhiGdyWN1lHhE2MDh281TsCtzK56S0uJxdmlIpSiWTFWIrrEiiewN2b8dXy3FSPfy0Fo1sGn54=
- CXX=g++-4.8
node_js: stable
addons:
firefox: latest
apt:
sources:
- google-chrome
- ubuntu-toolchain-r-test
packages:
- google-chrome-stable
- g++-4.8
sauce_connect: true
script:
- xvfb-run wct -l chrome
- xvfb-run wct -l firefox
- "if [ \"${TRAVIS_PULL_REQUEST}\" = \"false\" ]; then wct -s 'default'; fi"

View file

@ -1,6 +1,6 @@
{
"name": "paper-dialog-behavior",
"version": "1.1.0",
"version": "1.1.1",
"description": "Implements a behavior used for material design dialogs",
"authors": "The Polymer Authors",
"keywords": [
@ -21,7 +21,7 @@
"ignore": [],
"dependencies": {
"iron-overlay-behavior": "PolymerElements/iron-overlay-behavior#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.0.4",
"paper-styles": "PolymerElements/paper-styles#^1.1.0",
"polymer": "Polymer/polymer#^1.1.0"
},
"devDependencies": {
@ -29,7 +29,7 @@
"paper-button": "PolymerElements/paper-button#^1.0.0",
"paper-dialog-scrollable": "PolymerElements/paper-dialog-scrollable#^1.0.0",
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
"web-component-tester": "*",
"web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}
}

View file

@ -24,7 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../paper-styles/demo-pages.html">
<link rel="import" href="../../paper-button/paper-button.html">
<link rel="import" href="../../paper-dialog-scrollable/paper-dialog-scrollable.html">
<style is="custom-style">
.centered {
text-align: center;
@ -48,11 +48,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<h2>Alert</h2>
<p>Discard draft?</p>
<div class="buttons">
<paper-button data-dialog="multiple">More details</paper-button>
<paper-button dialog-dismiss>Cancel</paper-button>
<paper-button dialog-confirm autofocus>Discard</paper-button>
</div>
</simple-dialog>
<simple-dialog id="multiple" modal>
<h2>Details</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<paper-button dialog-confirm autofocus>OK</paper-button>
</simple-dialog>
<button data-dialog="scrolling">scrolling</button>
<simple-dialog id="scrolling">

View file

@ -113,25 +113,13 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
},
attached: function() {
this._observer = this._observe(this);
// this._observer is used by iron-overlay-behavior
this._ariaObserver = Polymer.dom(this).observeNodes(this._updateAriaLabelledBy);
this._updateAriaLabelledBy();
},
detached: function() {
if (this._observer) {
this._observer.disconnect();
}
},
_observe: function(node) {
var observer = new MutationObserver(function() {
this._updateAriaLabelledBy();
}.bind(this));
observer.observe(node, {
childList: true,
subtree: true
});
return observer;
Polymer.dom(this).unobserveNodes(this._ariaObserver);
},
_modalChanged: function() {
@ -175,57 +163,52 @@ The `aria-labelledby` attribute will be set to the header element, if one exists
},
_onDialogClick: function(event) {
var target = event.target;
var target = Polymer.dom(event).rootTarget;
while (target && target !== this) {
if (target.hasAttribute) {
if (target.hasAttribute('dialog-dismiss')) {
this._updateClosingReasonConfirmed(false);
this.close();
event.stopPropagation();
break;
} else if (target.hasAttribute('dialog-confirm')) {
this._updateClosingReasonConfirmed(true);
this.close();
event.stopPropagation();
break;
}
}
target = target.parentNode;
target = Polymer.dom(target).parentNode;
}
},
_onIronOverlayOpened: function() {
if (this.modal) {
document.body.addEventListener('focus', this._boundOnFocus, true);
this.backdropElement.addEventListener('click', this._boundOnBackdropClick);
document.body.addEventListener('click', this._boundOnBackdropClick, true);
}
},
_onIronOverlayClosed: function() {
this._lastFocusedElement = null;
document.body.removeEventListener('focus', this._boundOnFocus, true);
this.backdropElement.removeEventListener('click', this._boundOnBackdropClick);
document.body.removeEventListener('click', this._boundOnBackdropClick, true);
},
_onFocus: function(event) {
if (this.modal) {
var target = event.target;
while (target && target !== this && target !== document.body) {
target = target.parentNode;
}
if (target) {
if (target === document.body) {
if (this._lastFocusedElement) {
this._lastFocusedElement.focus();
} else {
this._focusNode.focus();
}
} else {
this._lastFocusedElement = event.target;
}
if (this.modal && this._manager.currentOverlay() === this) {
if (Polymer.dom(event).path.indexOf(this) !== -1) {
this._lastFocusedElement = event.target;
} else if (this._lastFocusedElement) {
this._lastFocusedElement.focus();
} else {
this._focusNode.focus();
}
}
},
_onBackdropClick: function() {
if (this.modal) {
_onBackdropClick: function(event) {
if (this.modal && this._manager.currentOverlay() === this && Polymer.dom(event).path.indexOf(this) === -1) {
if (this._lastFocusedElement) {
this._lastFocusedElement.focus();
} else {

View file

@ -51,7 +51,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
padding: 8px 8px 8px 24px;
margin: 0;
color: var(--paper-dialog-button-color, --default-primary-color);
color: var(--paper-dialog-button-color, --primary-color);
@apply(--layout-horizontal);
@apply(--layout-end-justified);

View file

@ -54,7 +54,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
padding: 8px 8px 8px 24px;
margin: 0;
color: var(--paper-dialog-button-color, --default-primary-color);
color: var(--paper-dialog-button-color, --primary-color);
@apply(--layout-horizontal);
@apply(--layout-end-justified);

View file

@ -1,5 +1,4 @@
<!doctype html>
<!--
<!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
@ -7,9 +6,7 @@ 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>
--><html><head>
<title>paper-dialog tests</title>
@ -23,12 +20,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<body>
<script>
WCT.loadSuites([
'paper-dialog-behavior.html'
'paper-dialog-behavior.html',
'paper-dialog-behavior.html?dom=shadow'
]);
</script>
</body>
</html>
</body></html>

View file

@ -24,6 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../../test-fixture/test-fixture.html">
<link rel="import" href="test-dialog.html">
<link rel="import" href="test-buttons.html">
</head>
<body>
@ -41,6 +42,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="buttons">
<template>
<test-dialog>
<p>Dialog with test-buttons</p>
<test-buttons class="buttons"></test-buttons>
</test-dialog>
</template>
</test-fixture>
<test-fixture id="modal">
<template>
<test-dialog modal>
@ -89,6 +99,37 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<test-fixture id="multiple">
<template>
<test-dialog modal id="dialog1">
<p>Dialog 1</p>
</test-dialog>
<test-dialog modal id="dialog2">
<p>Dialog 2</p>
</test-dialog>
</template>
</test-fixture>
<test-fixture id="nestedmodals">
<template>
<test-dialog modal opened>
<p>Dialog 1</p>
<div class="buttons">
<button dialog-dismiss>dismiss</button>
<button dialog-confirm autofocus>confirm</button>
</div>
<test-dialog modal opened>
<p>Dialog 2</p>
<div class="buttons">
<button dialog-dismiss>dismiss</button>
<button dialog-confirm autofocus>confirm</button>
</div>
</test-dialog>
</test-dialog>
</template>
</test-fixture>
<script>
function runAfterOpen(dialog, cb) {
@ -125,6 +166,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('dialog-dismiss button inside a custom element is handled', function(done) {
var dialog = fixture('buttons');
runAfterOpen(dialog, function() {
dialog.addEventListener('iron-overlay-closed', function(event) {
assert.isFalse(event.detail.canceled, 'dialog is not canceled');
assert.isFalse(event.detail.confirmed, 'dialog is not confirmed');
done();
});
Polymer.dom(dialog).querySelector('test-buttons').$.dismiss.click();
// We don't wait too long to fail.
setTimeout(function didNotClose() {
done(new Error('dialog-dismiss click did not close overlay'));
}, 20);
});
});
test('clicking dialog-confirm button closes the dialog with confirmation', function(done) {
var dialog = fixture('basic');
runAfterOpen(dialog, function() {
@ -137,13 +194,44 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('with-backdrop works', function() {
var dialog = fixture('backdrop');
test('dialog-confirm button inside a custom element is handled', function(done) {
var dialog = fixture('buttons');
runAfterOpen(dialog, function() {
assert.isTrue(dialog.backdropElement.opened, 'backdrop is open');
dialog.addEventListener('iron-overlay-closed', function(event) {
assert.isFalse(event.detail.canceled, 'dialog is not canceled');
assert.isTrue(event.detail.confirmed, 'dialog is confirmed');
done();
});
Polymer.dom(dialog).querySelector('test-buttons').$.confirm.click();
// We don't wait too long to fail.
setTimeout(function didNotClose() {
done(new Error('dialog-confirm click did not close overlay'));
}, 20);
});
});
test('clicking dialog-dismiss button closes only the dialog where is contained', function(done) {
var dialog = fixture('nestedmodals');
var innerDialog = Polymer.dom(dialog).querySelector('test-dialog');
Polymer.dom(innerDialog).querySelector('[dialog-dismiss]').click();
setTimeout(function() {
assert.isFalse(innerDialog.opened, 'inner dialog is closed');
assert.isTrue(dialog.opened, 'dialog is still open');
done();
}, 10);
});
test('clicking dialog-confirm button closes only the dialog where is contained', function(done) {
var dialog = fixture('nestedmodals');
var innerDialog = Polymer.dom(dialog).querySelector('test-dialog');
Polymer.dom(innerDialog).querySelector('[dialog-confirm]').click();
setTimeout(function() {
assert.isFalse(innerDialog.opened, 'inner dialog is closed');
assert.isTrue(dialog.opened, 'dialog is still open');
done();
}, 10);
});
test('modal dialog has backdrop', function() {
var dialog = fixture('modal');
assert.isTrue(dialog.withBackdrop, 'withBackdrop is true');
@ -157,7 +245,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
test('clicking outside a modal dialog does not move focus from dialog', function(done) {
var dialog = fixture('modal');
runAfterOpen(dialog, function() {
dialog.backdropElement.click();
document.body.click();
setTimeout(function() {
assert.equal(document.activeElement, Polymer.dom(dialog).querySelector('[autofocus]'), 'document.activeElement is the autofocused button');
done();
@ -178,6 +266,76 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
});
});
test('multiple modal dialogs opened, handle focus change', function(done) {
var dialogs = fixture('multiple');
var focusChange = sinon.stub();
document.body.addEventListener('focus', focusChange, true);
runAfterOpen(dialogs[0], function() {
// Wait 10ms to allow focus changes
dialogs[1].async(dialogs[1].open, 10);
dialogs[1].addEventListener('iron-overlay-opened', function() {
// Wait 10ms to allow focus changes
setTimeout(function() {
// Should not enter in an infinite loop.
assert.equal(focusChange.callCount, 2, 'focus change count');
done();
}, 10);
});
});
});
test('multiple modal dialogs opened, handle backdrop click', function(done) {
var dialogs = fixture('multiple');
var focusChange = sinon.stub();
document.body.addEventListener('focus', focusChange, true);
runAfterOpen(dialogs[0], function() {
// Wait 10ms to allow focus changes
dialogs[1].async(dialogs[1].open, 10);
dialogs[1].addEventListener('iron-overlay-opened', function() {
// This will trigger click listener for both dialogs.
document.body.click();
// Wait 10ms to allow focus changes
setTimeout(function() {
// Should not enter in an infinite loop.
assert.equal(focusChange.callCount, 2, 'focus change count');
done();
}, 10);
});
});
});
test('focus is given to the autofocus element when clicking on backdrop', function(done) {
var dialog = fixture('modal');
dialog.addEventListener('iron-overlay-opened', onFirstOpen);
dialog.open();
function onFirstOpen() {
dialog.removeEventListener('iron-overlay-opened', onFirstOpen);
dialog.addEventListener('iron-overlay-closed', onFirstClose);
// Set the focus on dismiss button
// Calling .focus() won't trigger the dialog._onFocus
Polymer.dom(dialog).querySelector('[dialog-dismiss]').dispatchEvent(new Event('focus'));
// Close the dialog
dialog.close();
}
function onFirstClose() {
dialog.removeEventListener('iron-overlay-closed', onFirstClose);
dialog.addEventListener('iron-overlay-opened', onSecondOpen);
dialog.open();
}
function onSecondOpen() {
document.body.click();
setTimeout(function() {
assert.equal(document.activeElement, Polymer.dom(dialog).querySelector('[autofocus]'), 'document.activeElement is the autofocused button');
done();
}, 10);
}
});
});
suite('a11y', function() {

View file

@ -0,0 +1,30 @@
<!--
@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">
<dom-module id="test-buttons">
<template>
<button dialog-dismiss id="dismiss">dismiss</button>
<button dialog-confirm id="confirm">confirm</button>
</template>
</dom-module>
<script>
(function() {
Polymer({
is: 'test-buttons'
});
})();
</script>