mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update prompt text
This commit is contained in:
parent
b63aaeb909
commit
ed4d08ab68
22 changed files with 401 additions and 146 deletions
|
@ -21,19 +21,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<link rel="import" href="../iron-dropdown-scroll-manager.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="x-scrollable-element.html">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<test-fixture id="DOMSubtree">
|
||||
<template>
|
||||
<div id="Parent">
|
||||
<div id="ChildOne">
|
||||
<div id="GrandchildOne"></div>
|
||||
</div>
|
||||
<div id="ChildTwo">
|
||||
<div id="GrandchildTwo"></div>
|
||||
</div>
|
||||
</div>
|
||||
<x-scrollable-element id="Parent"></x-scrollable-element>
|
||||
</template>
|
||||
</test-fixture>
|
||||
<script>
|
||||
|
@ -47,14 +41,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
setup(function() {
|
||||
parent = fixture('DOMSubtree');
|
||||
childOne = parent.querySelector('#ChildOne');
|
||||
childTwo = parent.querySelector('#ChildTwo');
|
||||
grandChildOne = parent.querySelector('#GrandchildOne');
|
||||
grandChildTwo = parent.querySelector('#GrandchildTwo');
|
||||
childOne = parent.$$('#ChildOne');
|
||||
childTwo = parent.$$('#ChildTwo');
|
||||
grandChildOne = parent.$$('#GrandchildOne');
|
||||
grandChildTwo = parent.$$('#GrandchildTwo');
|
||||
ancestor = document.body;
|
||||
});
|
||||
|
||||
suite('contraining scroll in the DOM', function() {
|
||||
suite('constraining scroll in the DOM', function() {
|
||||
setup(function() {
|
||||
Polymer.IronDropdownScrollManager.pushScrollLock(childOne);
|
||||
});
|
||||
|
@ -99,6 +93,58 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
expect(Polymer.IronDropdownScrollManager.elementIsScrollLocked(parent))
|
||||
.to.be.equal(false);
|
||||
});
|
||||
|
||||
test('does not check locked elements when there are no locking elements', function() {
|
||||
sinon.spy(Polymer.IronDropdownScrollManager, 'elementIsScrollLocked');
|
||||
childOne.dispatchEvent(new CustomEvent('wheel', {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}));
|
||||
expect(Polymer.IronDropdownScrollManager
|
||||
.elementIsScrollLocked.callCount).to.be.eql(1);
|
||||
Polymer.IronDropdownScrollManager.removeScrollLock(childOne);
|
||||
childOne.dispatchEvent(new CustomEvent('wheel', {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
}));
|
||||
expect(Polymer.IronDropdownScrollManager
|
||||
.elementIsScrollLocked.callCount).to.be.eql(1);
|
||||
});
|
||||
|
||||
suite('various scroll events', function() {
|
||||
var scrollEvents;
|
||||
var events;
|
||||
|
||||
setup(function() {
|
||||
scrollEvents = [
|
||||
'wheel',
|
||||
'mousewheel',
|
||||
'DOMMouseScroll',
|
||||
'touchmove'
|
||||
];
|
||||
|
||||
events = scrollEvents.map(function(scrollEvent) {
|
||||
return new CustomEvent(scrollEvent, {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('prevents wheel events from locked elements', function() {
|
||||
events.forEach(function(event) {
|
||||
childTwo.dispatchEvent(event);
|
||||
expect(event.defaultPrevented).to.be.eql(true);
|
||||
});
|
||||
});
|
||||
|
||||
test('allows wheel events from unlocked elements', function() {
|
||||
events.forEach(function(event) {
|
||||
childOne.dispatchEvent(event);
|
||||
expect(event.defaultPrevented).to.be.eql(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -118,6 +118,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
contentRect.height > 0;
|
||||
}
|
||||
|
||||
function runAfterOpen(overlay, cb) {
|
||||
overlay.addEventListener('iron-overlay-opened', function () {
|
||||
Polymer.Base.async(cb, 1);
|
||||
});
|
||||
overlay.open();
|
||||
}
|
||||
|
||||
suite('<iron-dropdown>', function() {
|
||||
var dropdown;
|
||||
var content;
|
||||
|
@ -133,31 +140,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
|
||||
test('shows dropdown content when opened', function(done) {
|
||||
dropdown.open();
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
expect(elementIsVisible(content)).to.be.equal(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('hides dropdown content when outside is clicked', function(done) {
|
||||
dropdown.open();
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
expect(elementIsVisible(content)).to.be.equal(true);
|
||||
|
||||
// The document capture-click listeners are set async.
|
||||
// Note(noms): I think this bit in iron-overlay-behavior is pretty
|
||||
// brittle, so if the tests start failing in the future, make sure
|
||||
// _toggleListeners is getting called at the right time.
|
||||
MockInteractions.tap(dropdown.parentNode);
|
||||
Polymer.Base.async(function() {
|
||||
MockInteractions.tap(dropdown.parentNode);
|
||||
Polymer.Base.async(function() {
|
||||
expect(elementIsVisible(content)).to.be.equal(false);
|
||||
done();
|
||||
}, 100);
|
||||
}, 1);
|
||||
expect(elementIsVisible(content)).to.be.equal(false);
|
||||
done();
|
||||
}, 10);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -167,9 +163,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
content = Polymer.dom(dropdown).querySelector('.dropdown-content');
|
||||
});
|
||||
test('focuses the content when opened', function(done) {
|
||||
dropdown.open();
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
expect(document.activeElement).to.be.equal(content);
|
||||
done();
|
||||
});
|
||||
|
@ -179,9 +173,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
var focusableChild = Polymer.dom(content).querySelector('div[tabindex]');
|
||||
dropdown.focusTarget = focusableChild;
|
||||
|
||||
dropdown.open();
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
expect(document.activeElement).to.not.be.equal(content);
|
||||
expect(document.activeElement).to.be.equal(focusableChild);
|
||||
done();
|
||||
|
@ -193,14 +185,40 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
suite('locking scroll', function() {
|
||||
var dropdown;
|
||||
|
||||
setup(function() {
|
||||
dropdown = fixture('TrivialDropdown');
|
||||
});
|
||||
|
||||
test('should lock, only once', function(done) {
|
||||
var openCount = 0;
|
||||
runAfterOpen(dropdown, function() {
|
||||
expect(Polymer.IronDropdownScrollManager._lockingElements.length)
|
||||
.to.be.equal(1);
|
||||
expect(Polymer.IronDropdownScrollManager.elementIsScrollLocked(document.body))
|
||||
.to.be.equal(true);
|
||||
|
||||
if(openCount === 0) {
|
||||
// This triggers a second `pushScrollLock` with the same element, however
|
||||
// that should not add the element to the `_lockingElements` stack twice
|
||||
dropdown.close();
|
||||
dropdown.open();
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
openCount++;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
suite('non locking scroll', function() {
|
||||
var dropdown;
|
||||
|
||||
setup(function() {
|
||||
dropdown = fixture('NonLockingDropdown');
|
||||
});
|
||||
|
||||
test('can be disabled with `allowOutsideScroll`', function(done) {
|
||||
dropdown.open();
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
expect(Polymer.IronDropdownScrollManager.elementIsScrollLocked(document.body))
|
||||
.to.be.equal(false);
|
||||
done();
|
||||
|
@ -219,9 +237,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
var parentRect;
|
||||
var dropdownRect;
|
||||
|
||||
dropdown.opened = true;
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
dropdownRect = dropdown.getBoundingClientRect();
|
||||
parentRect = parent.getBoundingClientRect();
|
||||
|
||||
|
@ -230,7 +246,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
expect(dropdownRect.top).to.be.closeTo(parentRect.top, 0.1);
|
||||
expect(dropdownRect.right).to.be.closeTo(parentRect.right, 0.1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
test('can be re-aligned to the bottom', function(done) {
|
||||
|
@ -238,9 +254,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
var dropdownRect;
|
||||
|
||||
dropdown.verticalAlign = 'bottom';
|
||||
dropdown.opened = true;
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
parentRect = parent.getBoundingClientRect();
|
||||
dropdownRect = dropdown.getBoundingClientRect();
|
||||
|
||||
|
@ -249,7 +263,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
expect(dropdownRect.bottom).to.be.closeTo(parentRect.bottom, 0.1);
|
||||
expect(dropdownRect.right).to.be.closeTo(parentRect.right, 0.1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -263,9 +277,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
|
||||
test('can be offset towards the bottom right', function(done) {
|
||||
dropdown.opened = true;
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
dropdownRect = dropdown.getBoundingClientRect();
|
||||
|
||||
dropdown.verticalOffset = 10;
|
||||
|
@ -277,13 +289,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
// horizontalAlign is left, so a positive offset moves to the right.
|
||||
expect(dropdownRect.left + 10).to.be.closeTo(offsetDropdownRect.left, 0.1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
test('can be offset towards the top left', function(done) {
|
||||
dropdown.opened = true;
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
dropdownRect = dropdown.getBoundingClientRect();
|
||||
|
||||
dropdown.verticalOffset = -10;
|
||||
|
@ -295,7 +305,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
// horizontalAlign is left, so a negative offset moves to the left.
|
||||
expect(dropdownRect.left - 10).to.be.closeTo(offsetDropdownRect.left, 0.1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -309,9 +319,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
|
||||
test('can be offset towards the top left', function(done) {
|
||||
dropdown.opened = true;
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
dropdownRect = dropdown.getBoundingClientRect();
|
||||
|
||||
dropdown.verticalOffset = 10;
|
||||
|
@ -323,13 +331,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
// horizontalAlign is right, so a positive offset moves to the left.
|
||||
expect(dropdownRect.right - 10).to.be.closeTo(offsetDropdownRect.right, 0.1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
test('can be offset towards the bottom right', function(done) {
|
||||
dropdown.opened = true;
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
dropdownRect = dropdown.getBoundingClientRect();
|
||||
|
||||
dropdown.verticalOffset = -10;
|
||||
|
@ -341,7 +347,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
// horizontalAlign is right, so a positive offset moves to the right.
|
||||
expect(dropdownRect.right + 10).to.be.closeTo(offsetDropdownRect.right, 0.1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -352,9 +358,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
test('with horizontalAlign=left', function(done) {
|
||||
var parent = fixture('RTLDropdownLeft');
|
||||
dropdown = parent.querySelector('iron-dropdown');
|
||||
dropdown.open();
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
// In RTL, if `horizontalAlign` is "left", that's the same as
|
||||
// being right-aligned in LTR. So the dropdown should be in the top
|
||||
// right corner.
|
||||
|
@ -368,9 +372,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
test('with horizontalAlign=right', function(done) {
|
||||
var parent = fixture('RTLDropdownRight');
|
||||
dropdown = parent.querySelector('iron-dropdown');
|
||||
dropdown.open();
|
||||
|
||||
Polymer.Base.async(function() {
|
||||
runAfterOpen(dropdown, function () {
|
||||
// In RTL, if `horizontalAlign` is "right", that's the same as
|
||||
// being left-aligned in LTR. So the dropdown should be in the top
|
||||
// left corner.
|
||||
|
|
27
dashboard-ui/bower_components/iron-dropdown/test/x-scrollable-element.html
vendored
Normal file
27
dashboard-ui/bower_components/iron-dropdown/test/x-scrollable-element.html
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!--
|
||||
@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="x-scrollable-element">
|
||||
<template>
|
||||
<div id="ChildOne">
|
||||
<div id="GrandchildOne"></div>
|
||||
</div>
|
||||
<div id="ChildTwo">
|
||||
<div id="GrandchildTwo"></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
Polymer({
|
||||
is: 'x-scrollable-element'
|
||||
});
|
||||
</script>
|
||||
</dom-module>
|
Loading…
Add table
Add a link
Reference in a new issue