| OLD | NEW |
| (Empty) | |
| 1 <!doctype html> |
| 2 <!-- |
| 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 8 Code distributed by Google as part of the polymer project is also |
| 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <meta charset="UTF-8"> |
| 14 <title>paper-toggle-button basic tests</title> |
| 15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximu
m-scale=1.0"> |
| 16 |
| 17 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 18 <script src="../../web-component-tester/browser.js"></script> |
| 19 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
| 20 <script src="../../iron-test-helpers/mock-interactions.js"></script> |
| 21 |
| 22 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 23 <link rel="import" href="../paper-toggle-button.html"> |
| 24 |
| 25 </head> |
| 26 <body> |
| 27 |
| 28 <test-fixture id="Basic"> |
| 29 <template> |
| 30 <paper-toggle-button id="button"></paper-toggle-button> |
| 31 </template> |
| 32 </test-fixture> |
| 33 |
| 34 <script> |
| 35 suite('defaults', function() { |
| 36 var b1; |
| 37 |
| 38 setup(function() { |
| 39 b1 = fixture('Basic'); |
| 40 }); |
| 41 |
| 42 test('check button via click', function() { |
| 43 b1.addEventListener('click', function() { |
| 44 assert.isTrue(b1.getAttribute('aria-checked')); |
| 45 assert.isTrue(b1.checked); |
| 46 done(); |
| 47 }); |
| 48 MockInteractions.down(b1); |
| 49 }); |
| 50 |
| 51 test('toggle button via click', function() { |
| 52 b1.checked = true; |
| 53 b1.addEventListener('click', function() { |
| 54 assert.isFalse(b1.getAttribute('aria-checked')); |
| 55 assert.isFalse(b1.checked); |
| 56 done(); |
| 57 }); |
| 58 MockInteractions.down(b1); |
| 59 }); |
| 60 |
| 61 test('disabled button cannot be clicked', function() { |
| 62 b1.disabled = true; |
| 63 b1.addEventListener('click', function() { |
| 64 assert.isTrue(b1.getAttribute('aria-checked')); |
| 65 assert.isTrue(b1.checked); |
| 66 done(); |
| 67 }); |
| 68 MockInteractions.down(b1); |
| 69 }); |
| 70 }); |
| 71 |
| 72 suite('a11y', function() { |
| 73 var b1; |
| 74 |
| 75 setup(function() { |
| 76 b1 = fixture('Basic'); |
| 77 }); |
| 78 |
| 79 test('has aria role "button"', function() { |
| 80 console.log(b1.getAttribute('role')); |
| 81 assert.isTrue(b1.getAttribute('role') == 'button'); |
| 82 }); |
| 83 }); |
| 84 </script> |
| 85 </body> |
| 86 </html> |
| OLD | NEW |