OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var ActiveDescendantAttribute = [ 'activeDescendant' ]; | 5 var ActiveDescendantAttribute = [ 'activeDescendant' ]; |
6 var LinkAttributes = [ 'url' ]; | 6 var LinkAttributes = [ 'url' ]; |
7 var DocumentAttributes = [ 'docUrl', | 7 var DocumentAttributes = [ 'docUrl', |
8 'docTitle', | 8 'docTitle', |
9 'docLoaded', | 9 'docLoaded', |
10 'docLoadingProgress' ]; | 10 'docLoadingProgress' ]; |
11 var ScrollableAttributes = [ 'scrollX', | 11 var ScrollableAttributes = [ 'scrollX', |
12 'scrollXMin', | 12 'scrollXMin', |
13 'scrollXMax', | 13 'scrollXMax', |
14 'scrollY', | 14 'scrollY', |
15 'scrollYMin', | 15 'scrollYMin', |
16 'scrollYMax' ]; | 16 'scrollYMax' ]; |
17 var EditableTextAttributes = [ 'textSelStart', | 17 var EditableTextAttributes = [ 'textSelStart', |
18 'textSelEnd' ]; | 18 'textSelEnd' ]; |
19 var RangeAttributes = [ 'valueForRange', | 19 var RangeAttributes = [ 'valueForRange', |
20 'minValueForRange', | 20 'minValueForRange', |
21 'maxValueForRange' ]; | 21 'maxValueForRange' ]; |
22 var TableAttributes = [ 'tableRowCount', | 22 var TableAttributes = [ 'tableRowCount', |
23 'tableColumnCount' ]; | 23 'tableColumnCount', |
| 24 'ariaRowCount', |
| 25 'ariaColumnCount' ]; |
24 var TableCellAttributes = [ 'tableCellColumnIndex', | 26 var TableCellAttributes = [ 'tableCellColumnIndex', |
| 27 'ariaCellColumnIndex', |
25 'tableCellColumnSpan', | 28 'tableCellColumnSpan', |
26 'tableCellRowIndex', | 29 'tableCellRowIndex', |
| 30 'ariaCellRowIndex', |
27 'tableCellRowSpan' ]; | 31 'tableCellRowSpan' ]; |
28 | 32 |
29 var allTests = [ | 33 var allTests = [ |
30 function testDocumentAndScrollAttributes() { | 34 function testDocumentAndScrollAttributes() { |
31 for (var i = 0; i < DocumentAttributes.length; i++) { | 35 for (var i = 0; i < DocumentAttributes.length; i++) { |
32 var attribute = DocumentAttributes[i]; | 36 var attribute = DocumentAttributes[i]; |
33 assertTrue(attribute in rootNode, | 37 assertTrue(attribute in rootNode, |
34 'rootNode should have a ' + attribute + ' attribute'); | 38 'rootNode should have a ' + attribute + ' attribute'); |
35 } | 39 } |
36 for (var i = 0; i < ScrollableAttributes.length; i++) { | 40 for (var i = 0; i < ScrollableAttributes.length; i++) { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 assertEq(0, scrollBars[0].valueForRange); | 167 assertEq(0, scrollBars[0].valueForRange); |
164 assertEq(0, scrollBars[0].minValueForRange); | 168 assertEq(0, scrollBars[0].minValueForRange); |
165 assertEq(1, scrollBars[0].maxValueForRange); | 169 assertEq(1, scrollBars[0].maxValueForRange); |
166 | 170 |
167 chrome.test.succeed(); | 171 chrome.test.succeed(); |
168 }, | 172 }, |
169 | 173 |
170 function testTableAttributes() { | 174 function testTableAttributes() { |
171 var table = rootNode.find({ role: 'grid' });; | 175 var table = rootNode.find({ role: 'grid' });; |
172 assertEq(3, table.tableRowCount); | 176 assertEq(3, table.tableRowCount); |
| 177 assertEq(103, table.ariaRowCount); |
173 assertEq(3, table.tableColumnCount); | 178 assertEq(3, table.tableColumnCount); |
| 179 assertEq(53, table.ariaColumnCount); |
174 | 180 |
175 var row1 = table.firstChild; | 181 var row1 = table.firstChild; |
176 var cell1 = row1.firstChild; | 182 var cell1 = row1.firstChild; |
177 assertEq(0, cell1.tableCellColumnIndex); | 183 assertEq(0, cell1.tableCellColumnIndex); |
| 184 assertEq(51, cell1.ariaCellColumnIndex); |
178 assertEq(1, cell1.tableCellColumnSpan); | 185 assertEq(1, cell1.tableCellColumnSpan); |
179 assertEq(0, cell1.tableCellRowIndex); | 186 assertEq(0, cell1.tableCellRowIndex); |
| 187 assertEq(101, cell1.ariaCellRowIndex); |
180 assertEq(1, cell1.tableCellRowSpan); | 188 assertEq(1, cell1.tableCellRowSpan); |
181 | 189 |
182 var cell2 = cell1.nextSibling; | 190 var cell2 = cell1.nextSibling; |
183 assertEq(1, cell2.tableCellColumnIndex); | 191 assertEq(1, cell2.tableCellColumnIndex); |
| 192 assertEq(52, cell2.ariaCellColumnIndex); |
184 assertEq(1, cell2.tableCellColumnSpan); | 193 assertEq(1, cell2.tableCellColumnSpan); |
185 assertEq(0, cell2.tableCellRowIndex); | 194 assertEq(0, cell2.tableCellRowIndex); |
| 195 assertEq(101, cell2.ariaCellRowIndex); |
186 assertEq(1, cell2.tableCellRowSpan); | 196 assertEq(1, cell2.tableCellRowSpan); |
187 | 197 |
188 var cell3 = cell2.nextSibling; | 198 var cell3 = cell2.nextSibling; |
189 assertEq(2, cell3.tableCellColumnIndex); | 199 assertEq(2, cell3.tableCellColumnIndex); |
| 200 assertEq(53, cell3.ariaCellColumnIndex); |
190 assertEq(1, cell3.tableCellColumnSpan); | 201 assertEq(1, cell3.tableCellColumnSpan); |
191 assertEq(0, cell3.tableCellRowIndex); | 202 assertEq(0, cell3.tableCellRowIndex); |
| 203 assertEq(101, cell3.ariaCellRowIndex); |
192 assertEq(1, cell3.tableCellRowSpan); | 204 assertEq(1, cell3.tableCellRowSpan); |
193 | 205 |
194 var row2 = row1.nextSibling; | 206 var row2 = row1.nextSibling; |
195 var cell4 = row2.firstChild; | 207 var cell4 = row2.firstChild; |
196 assertEq(0, cell4.tableCellColumnIndex); | 208 assertEq(0, cell4.tableCellColumnIndex); |
| 209 assertEq(51, cell4.ariaCellColumnIndex); |
197 assertEq(2, cell4.tableCellColumnSpan); | 210 assertEq(2, cell4.tableCellColumnSpan); |
198 assertEq(1, cell4.tableCellRowIndex); | 211 assertEq(1, cell4.tableCellRowIndex); |
| 212 assertEq(102, cell4.ariaCellRowIndex); |
199 assertEq(1, cell4.tableCellRowSpan); | 213 assertEq(1, cell4.tableCellRowSpan); |
200 | 214 |
201 var cell5 = cell4.nextSibling; | 215 var cell5 = cell4.nextSibling; |
202 assertEq(2, cell5.tableCellColumnIndex); | 216 assertEq(2, cell5.tableCellColumnIndex); |
| 217 assertEq(53, cell5.ariaCellColumnIndex); |
203 assertEq(1, cell5.tableCellColumnSpan); | 218 assertEq(1, cell5.tableCellColumnSpan); |
204 assertEq(1, cell5.tableCellRowIndex); | 219 assertEq(1, cell5.tableCellRowIndex); |
| 220 assertEq(102, cell5.ariaCellRowIndex); |
205 assertEq(2, cell5.tableCellRowSpan); | 221 assertEq(2, cell5.tableCellRowSpan); |
206 | 222 |
207 var row3 = row2.nextSibling; | 223 var row3 = row2.nextSibling; |
208 var cell6 = row3.firstChild; | 224 var cell6 = row3.firstChild; |
209 assertEq(0, cell6.tableCellColumnIndex); | 225 assertEq(0, cell6.tableCellColumnIndex); |
| 226 assertEq(51, cell6.ariaCellColumnIndex); |
210 assertEq(1, cell6.tableCellColumnSpan); | 227 assertEq(1, cell6.tableCellColumnSpan); |
211 assertEq(2, cell6.tableCellRowIndex); | 228 assertEq(2, cell6.tableCellRowIndex); |
| 229 assertEq(103, cell6.ariaCellRowIndex); |
212 assertEq(1, cell6.tableCellRowSpan); | 230 assertEq(1, cell6.tableCellRowSpan); |
213 | 231 |
214 var cell7 = cell6.nextSibling; | 232 var cell7 = cell6.nextSibling; |
215 assertEq(1, cell7.tableCellColumnIndex); | 233 assertEq(1, cell7.tableCellColumnIndex); |
| 234 assertEq(52, cell7.ariaCellColumnIndex); |
216 assertEq(1, cell7.tableCellColumnSpan); | 235 assertEq(1, cell7.tableCellColumnSpan); |
217 assertEq(2, cell7.tableCellRowIndex); | 236 assertEq(2, cell7.tableCellRowIndex); |
| 237 assertEq(103, cell7.ariaCellRowIndex); |
218 assertEq(1, cell7.tableCellRowSpan); | 238 assertEq(1, cell7.tableCellRowSpan); |
219 | 239 |
220 chrome.test.succeed(); | 240 chrome.test.succeed(); |
221 }, | 241 }, |
222 | 242 |
223 function testLangAttribute() { | 243 function testLangAttribute() { |
224 var p = rootNode.find({ attributes: { language: 'es-ES' } }); | 244 var p = rootNode.find({ attributes: { language: 'es-ES' } }); |
225 assertTrue(p !== undefined); | 245 assertTrue(p !== undefined); |
226 assertEq('paragraph', p.role); | 246 assertEq('paragraph', p.role); |
227 chrome.test.succeed(); | 247 chrome.test.succeed(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // Uncheckable nodes have a checked attribute of undefined | 296 // Uncheckable nodes have a checked attribute of undefined |
277 var checkTest4 = rootNode.find({ attributes: { name: 'check-test-4' } }); | 297 var checkTest4 = rootNode.find({ attributes: { name: 'check-test-4' } }); |
278 assertTrue(Boolean(checkTest4)); | 298 assertTrue(Boolean(checkTest4)); |
279 assertEq(checkTest4.checked, undefined); | 299 assertEq(checkTest4.checked, undefined); |
280 | 300 |
281 chrome.test.succeed(); | 301 chrome.test.succeed(); |
282 }, | 302 }, |
283 ]; | 303 ]; |
284 | 304 |
285 setUpAndRunTests(allTests, 'attributes.html'); | 305 setUpAndRunTests(allTests, 'attributes.html'); |
OLD | NEW |