accessible/tests/mochitest/table/test_headers_table.html

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:1f82b14ed070
1 <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
2 <html>
3 <head>
4 <title>Table header information cells for HTML table</title>
5 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
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="../table.js"></script>
16
17 <script type="application/javascript">
18
19 function doTest()
20 {
21 //////////////////////////////////////////////////////////////////////////
22 // column header from thead and row header from @scope inside of tfoot
23
24 var headerInfoMap = [
25 {
26 cell: "table1_cell_1",
27 rowHeaderCells: [],
28 columnHeaderCells: [ "table1_weekday", "table1_date" ]
29 },
30 {
31 cell: "table1_cell_2",
32 rowHeaderCells: [],
33 columnHeaderCells: [ "table1_day", "table1_date" ]
34 },
35 {
36 cell: "table1_cell_3",
37 rowHeaderCells: [],
38 columnHeaderCells: [ "table1_qty" ]
39 },
40 {
41 cell: "table1_cell_4",
42 rowHeaderCells: [],
43 columnHeaderCells: [ "table1_weekday", "table1_date" ]
44 },
45 {
46 cell: "table1_cell_5",
47 rowHeaderCells: [],
48 columnHeaderCells: [ "table1_day", "table1_date" ]
49 },
50 {
51 cell: "table1_cell_6",
52 rowHeaderCells: [],
53 columnHeaderCells: [ "table1_qty" ]
54 },
55 {
56 cell: "table1_cell_7",
57 rowHeaderCells: [ "table1_total" ],
58 columnHeaderCells: [ "table1_qty" ]
59 }
60 ];
61
62 testHeaderCells(headerInfoMap);
63
64 //////////////////////////////////////////////////////////////////////////
65 // column and row headers from thead and @scope
66
67 headerInfoMap = [
68 {
69 cell: "table2_cell_2",
70 rowHeaderCells: [ "table2_rh_1" ],
71 columnHeaderCells: [ "table2_ch_2" ]
72 },
73 {
74 cell: "table2_cell_3",
75 rowHeaderCells: [ "table2_rh_1" ],
76 columnHeaderCells: [ "table2_ch_3" ]
77 },
78 {
79 cell: "table2_cell_5",
80 rowHeaderCells: [ "table2_rh_2" ],
81 columnHeaderCells: [ "table2_ch_2" ]
82 },
83 {
84 cell: "table2_cell_6",
85 rowHeaderCells: [ "table2_rh_2" ],
86 columnHeaderCells: [ "table2_ch_3" ]
87 },
88 {
89 cell: "table2_rh_1",
90 rowHeaderCells: [],
91 columnHeaderCells: [ "table2_ch_1" ]
92 },
93 {
94 cell: "table2_rh_2",
95 rowHeaderCells: [],
96 columnHeaderCells: [ "table2_ch_1" ]
97 }
98 ];
99
100 testHeaderCells(headerInfoMap);
101
102 //////////////////////////////////////////////////////////////////////////
103 // column headers from @headers
104
105 headerInfoMap = [
106 {
107 cell: "table3_cell_1",
108 rowHeaderCells: [],
109 columnHeaderCells: [ "table3_ch_1" ]
110 },
111 {
112 cell: "table3_cell_2",
113 rowHeaderCells: [],
114 columnHeaderCells: [ "table3_ch_2" ]
115 }
116 ];
117
118 testHeaderCells(headerInfoMap);
119
120 //////////////////////////////////////////////////////////////////////////
121 // table consisted of one column
122
123 headerInfoMap = [
124 {
125 cell: "table4_cell",
126 rowHeaderCells: [],
127 columnHeaderCells: [ "table4_ch" ]
128 }
129 ];
130
131 testHeaderCells(headerInfoMap);
132
133 //////////////////////////////////////////////////////////////////////////
134 // table consisted of one row
135
136 headerInfoMap = [
137 {
138 cell: "table5_cell",
139 rowHeaderCells: [ "table5_rh" ],
140 columnHeaderCells: [ ]
141 }
142 ];
143
144 testHeaderCells(headerInfoMap);
145
146 //////////////////////////////////////////////////////////////////////////
147 // @headers points to table cells
148
149 headerInfoMap = [
150 {
151 cell: "table6_cell",
152 rowHeaderCells: [ "table6_rh" ],
153 columnHeaderCells: [ "table6_ch" ]
154 }
155 ];
156
157 testHeaderCells(headerInfoMap);
158
159 SimpleTest.finish();
160 }
161
162 SimpleTest.waitForExplicitFinish();
163 addA11yLoadEvent(doTest);
164 </script>
165 </head>
166
167 <body>
168 <a target="_blank"
169 title="implement IAccessibleTable2"
170 href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">
171 Bug 512424
172 </a>
173 <a target="_blank"
174 title="Table headers not associated when header is a td element with no scope"
175 href="https://bugzilla.mozilla.org/show_bug.cgi?id=704465">
176 Bug 704465
177 </a>
178
179 <p id="display"></p>
180 <div id="content" style="display: none"></div>
181 <pre id="test">
182 </pre>
183
184 <table id="table1" border="1">
185 <thead>
186 <tr>
187 <th id="table1_date" colspan="2">Date</th>
188 <th id="table1_qty" rowspan="2">Qty</th>
189 </tr>
190 <tr>
191 <th id="table1_weekday">Weekday</th>
192 <th id="table1_day">Day</th>
193 </tr>
194 </thead>
195 <tbody>
196 <tr>
197 <td id="table1_cell_1">Mon</td>
198 <td id="table1_cell_2">1</td>
199 <td id="table1_cell_3">20</td>
200 </tr>
201 <tr>
202 <td id="table1_cell_4">Thu</td>
203 <td id="table1_cell_5">2</td>
204 <td id="table1_cell_6">15</td>
205 </tr>
206 </tbody>
207 <tfoot>
208 <tr>
209 <th id="table1_total" scope="row" colspan="2">Total</th>
210 <td id="table1_cell_7">35</td>
211 </tr>
212 </tfoot>
213 </table>
214
215 <table id="table2" border="1">
216 <thead>
217 <tr>
218 <th id="table2_ch_1">col1</th>
219 <th id="table2_ch_2">col2</th>
220 <td id="table2_ch_3" scope="col">col3</td>
221 </tr>
222 </thead>
223 <tbody>
224 <tr>
225 <th id="table2_rh_1">row1</th>
226 <td id="table2_cell_2">cell1</td>
227 <td id="table2_cell_3">cell2</td>
228 </tr>
229 <tr>
230 <td id="table2_rh_2" scope="row">row2</td>
231 <td id="table2_cell_5">cell3</td>
232 <td id="table2_cell_6">cell4</td>
233 </tr>
234 </tbody>
235 </table>
236
237 <table id="table3" border="1">
238 <tr>
239 <td id="table3_cell_1" headers="table3_ch_1">cell1</td>
240 <td id="table3_cell_2" headers="table3_ch_2">cell2</td>
241 </tr>
242 <tr>
243 <td id="table3_ch_1" scope="col">col1</td>
244 <td id="table3_ch_2" scope="col">col2</td>
245 </tr>
246 </table>
247
248 <table id="table4">
249 <thead>
250 <tr>
251 <th id="table4_ch">colheader</th>
252 </tr>
253 </thead>
254 <tbody>
255 <tr>
256 <td id="table4_cell">bla</td>
257 </tr>
258 </tbody>
259 </table>
260
261 <table id="table5">
262 <tr>
263 <th id="table5_rh">rowheader</th>
264 <td id="table5_cell">cell</td>
265 </tr>
266 </table>
267
268 <table id="table6">
269 <tr>
270 <td>empty cell</th>
271 <td id="table6_ch">colheader</td>
272 </tr>
273 <tr>
274 <td id="table6_rh">rowheader</th>
275 <td id="table6_cell" headers="table6_ch table6_rh">cell</td>
276 </tr>
277 </table>
278 </body>
279 </html>

mercurial