OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 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 | 4 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 | 5 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 | 6 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 | 7 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 | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 9 --> |
10 <html> | 10 <html> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 }); | 89 }); |
90 | 90 |
91 test('disabled checkbox is always valid', function() { | 91 test('disabled checkbox is always valid', function() { |
92 c1.disabled = true; | 92 c1.disabled = true; |
93 c1.required = true; | 93 c1.required = true; |
94 assert.isTrue(c1.validate()); | 94 assert.isTrue(c1.validate()); |
95 | 95 |
96 c1.checked = true; | 96 c1.checked = true; |
97 assert.isTrue(c1.validate()); | 97 assert.isTrue(c1.validate()); |
98 }); | 98 }); |
99 | |
100 test('checkbox label can be updated', function() { | |
101 Polymer.dom(c1).textContent = 'Batman'; | |
102 c1.updateAriaLabel(); | |
103 assert.isTrue(c1.getAttribute('aria-label') == 'Batman'); | |
104 | |
105 Polymer.dom(c1).textContent = 'Robin'; | |
106 c1.updateAriaLabel(); | |
107 assert.isTrue(c1.getAttribute('aria-label') == 'Robin'); | |
108 }); | |
109 }); | 99 }); |
110 | 100 |
111 suite('a11y', function() { | 101 suite('a11y', function() { |
112 var c1; | 102 var c1; |
113 var c2; | 103 var c2; |
114 | 104 |
115 setup(function() { | 105 setup(function() { |
116 c1 = fixture('NoLabel'); | 106 c1 = fixture('NoLabel'); |
117 c2 = fixture('WithLabel'); | 107 c2 = fixture('WithLabel'); |
118 }); | 108 }); |
119 | 109 |
120 test('has aria role "checkbox"', function() { | 110 test('has aria role "checkbox"', function() { |
121 assert.isTrue(c1.getAttribute('role') == 'checkbox'); | 111 assert.isTrue(c1.getAttribute('role') == 'checkbox'); |
122 assert.isTrue(c2.getAttribute('role') == 'checkbox'); | 112 assert.isTrue(c2.getAttribute('role') == 'checkbox'); |
123 }); | 113 }); |
124 | 114 |
125 test('checkbox with no label has no aria label', function() { | 115 test('checkbox with no label has no aria label', function() { |
126 assert.isTrue(!c1.getAttribute('aria-label')); | 116 assert.isTrue(!c1.getAttribute('aria-label')); |
127 }); | 117 }); |
128 | 118 |
129 test('checkbox with a label sets an aria label', function() { | |
130 assert.isTrue(c2.getAttribute('aria-label') == "Batman"); | |
131 }); | |
132 | |
133 test('checkbox respects the user set aria-label', function() { | 119 test('checkbox respects the user set aria-label', function() { |
134 var c = fixture('AriaLabel'); | 120 var c = fixture('AriaLabel'); |
135 assert.isTrue(c.getAttribute('aria-label') == "Batman"); | 121 assert.isTrue(c.getAttribute('aria-label') == "Batman"); |
136 }); | 122 }); |
137 | 123 |
138 a11ySuite('NoLabel'); | 124 a11ySuite('NoLabel'); |
139 a11ySuite('WithLabel'); | 125 a11ySuite('WithLabel'); |
140 a11ySuite('AriaLabel'); | 126 a11ySuite('AriaLabel'); |
141 }); | 127 }); |
142 </script> | 128 </script> |
143 </body> | 129 </body> |
144 </html> | 130 </html> |
OLD | NEW |