mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
91 lines
2.7 KiB
HTML
91 lines
2.7 KiB
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
|
|
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">
|
|
<title>paper-toggle-button basic tests</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
|
|
|
<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-toggle-button.html">
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<test-fixture id="Basic">
|
|
<template>
|
|
<paper-toggle-button id="button"></paper-toggle-button>
|
|
</template>
|
|
</test-fixture>
|
|
|
|
<script>
|
|
suite('defaults', function() {
|
|
var b1;
|
|
|
|
setup(function() {
|
|
b1 = fixture('Basic');
|
|
});
|
|
|
|
test('check button via click', function(done) {
|
|
b1.addEventListener('click', function() {
|
|
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
|
|
assert.isTrue(b1.checked);
|
|
done();
|
|
});
|
|
MockInteractions.tap(b1);
|
|
});
|
|
|
|
test('toggle button via click', function(done) {
|
|
b1.checked = true;
|
|
b1.addEventListener('click', function() {
|
|
assert.isFalse(b1.getAttribute('aria-pressed') == 'true');
|
|
assert.isFalse(b1.checked);
|
|
done();
|
|
});
|
|
MockInteractions.tap(b1);
|
|
});
|
|
|
|
test('disabled button cannot be clicked', function(done) {
|
|
b1.disabled = true;
|
|
b1.checked = true;
|
|
MockInteractions.tap(b1);
|
|
|
|
setTimeout(function() {
|
|
assert.isTrue(b1.getAttribute('aria-pressed') == 'true');
|
|
assert.isTrue(b1.checked);
|
|
done();
|
|
}, 1);
|
|
});
|
|
});
|
|
|
|
suite('a11y', function() {
|
|
var b1;
|
|
|
|
setup(function() {
|
|
b1 = fixture('Basic');
|
|
});
|
|
|
|
test('has aria role "button"', function() {
|
|
console.log(b1.getAttribute('role'));
|
|
assert.isTrue(b1.getAttribute('role') == 'button');
|
|
});
|
|
|
|
a11ySuite('Basic');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|