AX: Expose table size and cell indexes on iOS
[WebKit-https.git] / LayoutTests / accessibility / aria-table-attributes.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../resources/js-test-pre.js"></script>
5 </head>
6 <body id="body">
7
8 <div id="grid" role="grid" aria-colcount="16" aria-rowcount="30">
9   <div role="rowgroup">
10     <div role="row" aria-rowindex="7">
11       <span id="cell1" role="columnheader" aria-colindex="2">First Name</span>
12       <span role="columnheader" aria-colindex="3">Last Name</span>
13       <span role="columnheader" aria-colindex="4">Company</span>
14       <span role="columnheader" aria-colindex="5">Address</span>
15     </div>
16   </div>
17   <div role="rowgroup">
18     <div role="row" aria-rowindex="8">
19       <span role="gridcell" aria-colindex="2" aria-rowindex="8">Fred</span>
20       <span role="gridcell" aria-colindex="3" aria-rowindex="8">Jackson</span>
21       <span id="cell2" role="gridcell" aria-colindex="4" aria-rowindex="8" aria-rowspan="2">Acme, Inc.</span>
22       <span id="cell3" role="gridcell" aria-colindex="5" aria-rowindex="8" aria-rowspan="0">123 Broad St.</span>
23     </div>
24     <div role="row" aria-rowindex="9">
25       <span role="gridcell" aria-colindex="2">Sara</span>
26       <span role="gridcell" aria-colindex="3">James</span>
27     </div>
28   </div>
29   <div role="rowgroup">
30     <div role="row" aria-rowindex="15">
31       <span role="gridcell" aria-colindex="2">Footer 1</span>
32       <span role="gridcell" aria-colindex="3">Footer 2</span>
33       <span role="gridcell" aria-colindex="4" aria-colspan="2">Footer 3</span>
34     </div>
35   </div>
36 </div>
37
38 <div id="grid2" role="grid" aria-colcount="16">
39   <div role="rowgroup">
40     <div role="row" aria-colindex="2">
41       <span role="columnheader">Name</span>
42       <span id="cell4" role="columnheader">Company</span>
43       <span id="cell5" role="columnheader" aria-colspan="3">Address</span>
44     </div>
45   </div>
46 </div>
47
48 <div id="grid3" role="grid">
49   <div role="row">
50     <span role="gridcell">Cell</span>
51     <span id="cell6" role="gridcell" aria-rowspan="0">Span Cell</span>
52   </div>
53   <div role="row">
54     <span role="gridcell">Cell</span>
55   </div>
56 </div>
57
58 <table role="grid">
59   <tr>
60     <td>January</td>
61     <td id="cell7" rowspan="2" aria-rowspan="3">$100</td>
62   </tr>
63   <tr><td>February</td></tr>
64 </table>
65
66 <script>
67
68     description("This tests that attributes related to aria table/grid are working correctly.");
69
70     if (window.accessibilityController) {
71     
72           var grid = accessibilityController.accessibleElementById("grid");
73           var cell1 = accessibilityController.accessibleElementById("cell1");
74           var cell2 = accessibilityController.accessibleElementById("cell2");
75           var cell3 = accessibilityController.accessibleElementById("cell3");
76           var cell4 = accessibilityController.accessibleElementById("cell4");
77           var cell5 = accessibilityController.accessibleElementById("cell5");
78           var cell6 = accessibilityController.accessibleElementById("cell6");
79           var cell7 = accessibilityController.accessibleElementById("cell7");
80           
81           // aria-colcount and aria-rowcount
82           shouldBe("grid.numberAttributeValue('AXARIAColumnCount')", "16");
83           shouldBe("grid.numberAttributeValue('AXARIARowCount')", "30");
84           shouldBe("grid.rowCount", "4");
85           shouldBe("grid.columnCount", "4");
86           
87           // aria-colindex and aria-rowindex
88           shouldBe("cell1.numberAttributeValue('AXARIAColumnIndex')", "2");
89           shouldBe("cell1.numberAttributeValue('AXARIARowIndex')", "7");
90           shouldBe("cell2.numberAttributeValue('AXARIAColumnIndex')", "4");
91           shouldBe("cell2.numberAttributeValue('AXARIARowIndex')", "8");
92           // aria-colindex from parent row
93           shouldBe("cell4.numberAttributeValue('AXARIAColumnIndex')", "3");
94           
95           // aria-colspan and aria-rowspan
96           shouldBe("cell2.rowIndexRange()", "'{1, 2}'");
97           shouldBe("cell5.columnIndexRange()", "'{2, 3}'");
98           // aria-rowspan="0"
99           shouldBe("cell3.rowIndexRange()", "'{1, 2}'");
100           shouldBe("cell6.rowIndexRange()", "'{0, 2}'");
101           // use rowspan for native table
102           shouldBe("cell7.rowIndexRange()", "'{0, 2}'");
103     }
104
105 </script>
106
107 <script src="../resources/js-test-post.js"></script>
108 </body>
109 </html>