OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 3 @license |
| 4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 5 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 7 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 8 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 9 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 10 --> |
10 <html> | 11 <html> |
11 <head> | 12 <head> |
12 <meta charset="UTF-8"> | 13 <meta charset="UTF-8"> |
13 <title>paper-fab a11y tests</title> | 14 <title>paper-fab a11y tests</title> |
14 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> | 15 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-
scale=1.0"> |
15 | 16 |
16 <script src="../../webcomponentsjs/webcomponents.js"></script> | 17 <script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
17 <script src="../../web-component-tester/browser.js"></script> | 18 <script src="../../web-component-tester/browser.js"></script> |
| 19 <script src="../../test-fixture/test-fixture-mocha.js"></script> |
18 | 20 |
19 <link href="../../core-icons/core-icons.html" rel="import"> | 21 <link rel="import" href="../../core-icons/core-icons.html"> |
20 <link href="../paper-fab.html" rel="import"> | 22 <link rel="import" href="../../test-fixture/test-fixture.html"> |
| 23 <link rel="import" href="../paper-fab.html"> |
21 | 24 |
22 </head> | 25 </head> |
23 <body> | 26 <body> |
24 | 27 |
25 <paper-fab id="fab1" icon="add"></paper-fab> | 28 <test-fixture id="A11yFabs"> |
26 | 29 <template> |
27 <paper-fab id="fab2" icon="add" disabled></paper-fab> | 30 <paper-fab id="fab1" icon="add"></paper-fab> |
28 | 31 <paper-fab id="fab2" icon="add" disabled></paper-fab> |
29 <paper-fab id="fab3" icon="add" aria-label="custom"></paper-fab> | 32 <paper-fab id="fab3" icon="add" aria-label="custom"></paper-fab> |
| 33 </template> |
| 34 </test-fixture> |
30 | 35 |
31 <script> | 36 <script> |
32 | 37 |
33 var f1 = document.getElementById('fab1'); | 38 var f1; |
34 var f2 = document.getElementById('fab2'); | 39 var f2; |
35 var f3 = document.getElementById('fab3'); | 40 var f3; |
| 41 |
| 42 setup(function() { |
| 43 var fabs = fixture('A11yFabs'); |
| 44 |
| 45 f1 = fabs[0]; |
| 46 f2 = fabs[1]; |
| 47 f3 = fabs[2]; |
| 48 }); |
36 | 49 |
37 test('aria role is a button', function() { | 50 test('aria role is a button', function() { |
38 assert.strictEqual(f1.getAttribute('role'), 'button'); | 51 assert.strictEqual(f1.getAttribute('role'), 'button'); |
39 }); | 52 }); |
40 | 53 |
41 test('aria-disabled is set', function(done) { | 54 test('aria-disabled is set', function() { |
42 assert.ok(f2.hasAttribute('aria-disabled')); | 55 assert.ok(f2.hasAttribute('aria-disabled')); |
43 f2.removeAttribute('disabled'); | 56 f2.removeAttribute('disabled'); |
44 flush(function() { | 57 assert.strictEqual(f2.getAttribute('aria-disabled'), 'false'); |
45 assert.ok(!f2.hasAttribute('aria-disabled')); | |
46 done(); | |
47 }); | |
48 }); | 58 }); |
49 | 59 |
50 test('aria-label is set', function() { | 60 test('aria-label is set'); |
51 assert.strictEqual(f1.getAttribute('aria-label'), 'add'); | |
52 }); | |
53 | 61 |
54 test('user-defined aria-label is preserved', function(done) { | 62 test('user-defined aria-label is preserved', function() { |
55 assert.strictEqual(f3.getAttribute('aria-label'), 'custom'); | 63 assert.strictEqual(f3.getAttribute('aria-label'), 'custom'); |
56 f3.icon = 'arrow-forward'; | 64 f3.icon = 'arrow-forward'; |
57 flush(function() { | 65 assert.strictEqual(f3.getAttribute('aria-label'), 'custom'); |
58 assert.strictEqual(f3.getAttribute('aria-label'), 'custom'); | |
59 done(); | |
60 }); | |
61 }); | 66 }); |
62 | 67 |
63 </script> | 68 </script> |
64 | 69 |
65 </body> | 70 </body> |
66 </html> | 71 </html> |
OLD | NEW |