|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 |
|
4 <head> |
|
5 <title>Table accessible tree and table interface tests for HTML tables</title> |
|
6 <link rel="stylesheet" type="text/css" |
|
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../common.js"></script> |
|
14 <script type="application/javascript" |
|
15 src="../role.js"></script> |
|
16 <script type="application/javascript" |
|
17 src="../table.js"></script> |
|
18 |
|
19 <script type="application/javascript"> |
|
20 function doTest() |
|
21 { |
|
22 ////////////////////////////////////////////////////////////////////////// |
|
23 // column headers from thead and tfoot |
|
24 |
|
25 cellsArray = [ |
|
26 [kColHeaderCell, kColHeaderCell, kColSpanned], |
|
27 [kRowSpanned, kColHeaderCell, kColHeaderCell], |
|
28 [kDataCell, kDataCell, kDataCell], |
|
29 [kColHeaderCell, kColHeaderCell, kColHeaderCell] |
|
30 ]; |
|
31 |
|
32 testTableStruct("table1", cellsArray); |
|
33 |
|
34 ////////////////////////////////////////////////////////////////////////// |
|
35 // row and column headers from thead and @scope |
|
36 |
|
37 var cellsArray = [ |
|
38 [kColHeaderCell, kColHeaderCell, kColHeaderCell], |
|
39 [kRowHeaderCell, kDataCell, kDataCell], |
|
40 [kRowHeaderCell, kDataCell, kDataCell] |
|
41 ]; |
|
42 |
|
43 testTableStruct("table2", cellsArray); |
|
44 |
|
45 ////////////////////////////////////////////////////////////////////////// |
|
46 // caption and @summary |
|
47 |
|
48 cellsArray = [ |
|
49 [kColHeaderCell, kColHeaderCell, kColHeaderCell, kColHeaderCell], |
|
50 [kRowHeaderCell, kDataCell, kDataCell, kDataCell], |
|
51 [kRowHeaderCell, kDataCell, kDataCell, kDataCell] |
|
52 ]; |
|
53 |
|
54 testTableStruct("table3", cellsArray, kNoColumnHeader, |
|
55 "Test Table", |
|
56 "this is a test table for nsIAccessibleTable"); |
|
57 |
|
58 ////////////////////////////////////////////////////////////////////////// |
|
59 // row and column spans |
|
60 |
|
61 cellsArray = [ |
|
62 [kDataCell, kDataCell, kDataCell, kColSpanned, kDataCell, kDataCell, kDataCell, kDataCell], |
|
63 [kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kRowSpanned], |
|
64 [kDataCell, kDataCell, kColSpanned, kDataCell, kDataCell, kDataCell, kDataCell, kRowSpanned], |
|
65 [kDataCell, kRowSpanned, kSpanned, kDataCell, kDataCell, kRowSpanned, kDataCell, kRowSpanned] |
|
66 ]; |
|
67 |
|
68 testTableStruct("table4", cellsArray); |
|
69 |
|
70 SimpleTest.finish(); |
|
71 } |
|
72 |
|
73 SimpleTest.waitForExplicitFinish(); |
|
74 addA11yLoadEvent(doTest); |
|
75 </script> |
|
76 </head> |
|
77 <body> |
|
78 |
|
79 <a target="_blank" |
|
80 title="Fix our nsHTMLAccessibleTable class so GetIndexAt and GetRowAtIndex and GetColumnAtIndex behave consistently" |
|
81 href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a> |
|
82 <a target="_blank" |
|
83 title="GetCellDataAt callers that expect an error if no cell is found are wrong" |
|
84 href="https://bugzilla.mozilla.org/show_bug.cgi?id=417912">Mozilla Bug 417912</a> |
|
85 <a target="_blank" |
|
86 title="create accessibles for HTML tr" |
|
87 href="https://bugzilla.mozilla.org/show_bug.cgi?id=493695">Mozilla Bug 493695</a> |
|
88 <a target="_blank" |
|
89 title="implement IAccessibleTable2" |
|
90 href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a> |
|
91 |
|
92 <p id="display"></p> |
|
93 <div id="content" style="display: none"></div> |
|
94 <pre id="test"> |
|
95 </pre> |
|
96 |
|
97 <table id="table1"> |
|
98 <thead> |
|
99 <tr> |
|
100 <th rowspan="2">col1</th><th colspan="2">col2</th> |
|
101 </tr> |
|
102 <tr> |
|
103 <th>col2sub1</th><th>col2sub2</th> |
|
104 </tr> |
|
105 </thead> |
|
106 <tbody> |
|
107 <tr> |
|
108 <td>cell1</td><td>cell2</td><td>cell3</td> |
|
109 </tr> |
|
110 </tbody> |
|
111 <tfoot> |
|
112 <tr> |
|
113 <th>col1</th><th>col2</th><th>col3</th> |
|
114 </tr> |
|
115 </tfoot> |
|
116 </table> |
|
117 |
|
118 <table id="table2"> |
|
119 <thead> |
|
120 <tr> |
|
121 <th id="table1_0">col1</th> |
|
122 <th id="table1_1">col2</th> |
|
123 <td id="table1_2" scope="col">col3</td> |
|
124 </tr> |
|
125 </thead> |
|
126 <tbody> |
|
127 <tr> |
|
128 <th id="table1_3">row1</th> |
|
129 <td id="table1_4">cell1</td> |
|
130 <td id="table1_5">cell2</td> |
|
131 </tr> |
|
132 <tr> |
|
133 <td id="table1_6" scope="row">row2</td> |
|
134 <td id="table1_7">cell3</td> |
|
135 <td id="table1_8">cell4</td> |
|
136 </tr> |
|
137 </tbody> |
|
138 </table> |
|
139 |
|
140 <table id="table3" border="1" |
|
141 summary="this is a test table for nsIAccessibleTable"> |
|
142 <caption>Test Table</caption> |
|
143 <thead> |
|
144 <tr> |
|
145 <th></th> |
|
146 <th>columnHeader_1</th> |
|
147 <th id ="col2a">columnHeader_2</th> |
|
148 <th>columnHeader_3</th> |
|
149 </tr> |
|
150 </thead> |
|
151 <tr> |
|
152 <th id="row2a">rowHeader_1</th> |
|
153 <td id="row2b">row1_column1</td> |
|
154 <td id ="col2b">row1_column2</td> |
|
155 <td id="row2c">row1_column3</td> |
|
156 </tr> |
|
157 <tr> |
|
158 <th>rowHeader_2</th> |
|
159 <td>row2_column1</td> |
|
160 <td id ="col2c">row2_column2</td> |
|
161 <td>row2_column3</td> |
|
162 </tr> |
|
163 </table> |
|
164 |
|
165 <table id="table4" cellpadding="2" cellspacing="2" border="1" width="50%"> |
|
166 <tbody> |
|
167 <tr> |
|
168 <td><br></td> |
|
169 <td><br></td> |
|
170 <td rowspan="1" colspan="2"><br></td> |
|
171 <td><br></td> |
|
172 <td><br></td> |
|
173 <td><br></td> |
|
174 <td rowspan="4" colspan="1"><br></td> |
|
175 </tr> |
|
176 <tr> |
|
177 <td><br></td> |
|
178 <td><br></td> |
|
179 <td><br></td> |
|
180 <td><br></td> |
|
181 <td><br></td> |
|
182 <td><br></td> |
|
183 <td><br></td> |
|
184 </tr> |
|
185 <tr> |
|
186 <td><br></td> |
|
187 <td rowspan="2" colspan="2">c1</td> |
|
188 <td><br></td> |
|
189 <td><br></td> |
|
190 <td rowspan="2" colspan="1"><br></td> |
|
191 <td><br></td> |
|
192 </tr> |
|
193 <tr> |
|
194 <td><br></td> |
|
195 <td><br></td> |
|
196 <td><br></td> |
|
197 <td><br></td> |
|
198 </tr> |
|
199 </tbody> |
|
200 </table> |
|
201 |
|
202 </body> |
|
203 </html> |