mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
merge from dev
This commit is contained in:
parent
1c8f02ce0f
commit
33b01d778c
911 changed files with 34157 additions and 57125 deletions
|
@ -20,9 +20,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
<script src="../../iron-test-helpers/mock-interactions.js"></script>
|
||||
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
<link rel="import" href="../../paper-input/paper-input.html">
|
||||
<link rel="import" href="../paper-item.html">
|
||||
<link rel="import" href="../paper-icon-item.html">
|
||||
|
||||
|
@ -31,7 +31,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<test-fixture id="item">
|
||||
<template>
|
||||
<div role="list">
|
||||
<div role="listbox">
|
||||
<paper-item>item</paper-item>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -39,13 +39,145 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
|
||||
<test-fixture id="iconItem">
|
||||
<template>
|
||||
<div role="list">
|
||||
<div role="listbox">
|
||||
<paper-icon-item>item</paper-icon-item>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="item-with-input">
|
||||
<template>
|
||||
<div role="list">
|
||||
<paper-item><input></paper-item>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="item-with-paper-input">
|
||||
<template>
|
||||
<div role="list">
|
||||
<paper-item><paper-input></paper-input></paper-item>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<test-fixture id="iconItem-with-input">
|
||||
<template>
|
||||
<div role="list">
|
||||
<paper-icon-item><input></paper-icon-item>
|
||||
</div>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
suite('paper-item basic', function() {
|
||||
var item, clickHandler;
|
||||
|
||||
setup(function() {
|
||||
item = fixture('item').querySelector('paper-item');
|
||||
clickHandler = sinon.spy();
|
||||
item.addEventListener('click', clickHandler);
|
||||
});
|
||||
|
||||
test('space triggers a click event', function(done) {
|
||||
MockInteractions.pressSpace(item);
|
||||
Polymer.Base.async(function(){
|
||||
// You need two ticks, one for the MockInteractions event, and one
|
||||
// for the button event.
|
||||
Polymer.Base.async(function(){
|
||||
expect(clickHandler.callCount).to.be.equal(1);
|
||||
done();
|
||||
}, 1);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('click triggers a click event', function(done) {
|
||||
MockInteractions.tap(item);
|
||||
Polymer.Base.async(function(){
|
||||
expect(clickHandler.callCount).to.be.equal(1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('paper-icon-item basic', function() {
|
||||
var item, clickHandler;
|
||||
|
||||
setup(function() {
|
||||
item = fixture('iconItem').querySelector('paper-icon-item');
|
||||
clickHandler = sinon.spy();
|
||||
item.addEventListener('click', clickHandler);
|
||||
});
|
||||
|
||||
test('space triggers a click event', function(done) {
|
||||
MockInteractions.pressSpace(item);
|
||||
Polymer.Base.async(function(){
|
||||
// You need two ticks, one for the MockInteractions event, and one
|
||||
// for the button event.
|
||||
Polymer.Base.async(function(){
|
||||
expect(clickHandler.callCount).to.be.equal(1);
|
||||
done();
|
||||
}, 1);
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('click triggers a click event', function(done) {
|
||||
MockInteractions.tap(item);
|
||||
Polymer.Base.async(function(){
|
||||
expect(clickHandler.callCount).to.be.equal(1);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('clickable element inside item', function() {
|
||||
test('paper-item: space in child native input does not trigger a click event', function(done) {
|
||||
var f = fixture('item-with-input');
|
||||
var outerItem = f.querySelector('paper-item');
|
||||
var innerInput = f.querySelector('input');
|
||||
|
||||
var itemClickHandler = sinon.spy();
|
||||
outerItem.addEventListener('click', itemClickHandler);
|
||||
|
||||
innerInput.focus();
|
||||
MockInteractions.pressSpace(innerInput);
|
||||
Polymer.Base.async(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(0);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('paper-item: space in child paper-input does not trigger a click event', function(done) {
|
||||
var f = fixture('item-with-paper-input');
|
||||
var outerItem = f.querySelector('paper-item');
|
||||
var innerInput = f.querySelector('paper-input');
|
||||
|
||||
var itemClickHandler = sinon.spy();
|
||||
outerItem.addEventListener('click', itemClickHandler);
|
||||
|
||||
innerInput.focus();
|
||||
MockInteractions.pressSpace(innerInput);
|
||||
Polymer.Base.async(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(0);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
|
||||
test('paper-icon-item: space in child input does not trigger a click event', function(done) {
|
||||
var f = fixture('iconItem-with-input');
|
||||
var outerItem = f.querySelector('paper-icon-item');
|
||||
var innerInput = f.querySelector('input');
|
||||
|
||||
var itemClickHandler = sinon.spy();
|
||||
outerItem.addEventListener('click', itemClickHandler);
|
||||
|
||||
MockInteractions.pressSpace(innerInput);
|
||||
Polymer.Base.async(function(){
|
||||
expect(itemClickHandler.callCount).to.be.equal(0);
|
||||
done();
|
||||
}, 1);
|
||||
});
|
||||
});
|
||||
|
||||
suite('item a11y tests', function() {
|
||||
var item, iconItem;
|
||||
|
@ -56,11 +188,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
|||
});
|
||||
|
||||
test('item has role="listitem"', function() {
|
||||
assert.equal(item.getAttribute('role'), 'listitem', 'has role="item"');
|
||||
assert.equal(item.getAttribute('role'), 'option', 'has role="option"');
|
||||
});
|
||||
|
||||
test('icon item has role="listitem"', function() {
|
||||
assert.equal(iconItem.getAttribute('role'), 'listitem', 'has role="item"');
|
||||
assert.equal(iconItem.getAttribute('role'), 'option', 'has role="option"');
|
||||
});
|
||||
|
||||
a11ySuite('item');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue