Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>HTML table tests</title>
5 <link rel="stylesheet" type="text/css"
6 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
8 <script type="application/javascript"
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <script type="application/javascript"
12 src="../common.js"></script>
13 <script type="application/javascript"
14 src="../role.js"></script>
16 <script type="application/javascript">
17 function doTest()
18 {
19 //////////////////////////////////////////////////////////////////////////
20 // grid having rowgroups
22 var accTree =
23 { TABLE: [
24 { GROUPING: [
25 { ROW: [
26 { GRID_CELL: [
27 { TEXT_LEAF: [ ] }
28 ] }
29 ] }
30 ] },
31 ] };
33 testAccessibleTree("grid", accTree);
35 //////////////////////////////////////////////////////////////////////////
36 // crazy grids (mad mix of ARIA and HTML tables)
38 accTree = {
39 role: ROLE_TABLE,
40 children: [
41 { // div@role="row"
42 role: ROLE_ROW,
43 tagName: "DIV",
44 children: [
45 { // caption text leaf
46 role: ROLE_TEXT_LEAF,
47 name: "caption",
48 children: [ ]
49 },
50 { // th generic accessible
51 role: ROLE_TEXT_CONTAINER,
52 children: [
53 { // th text leaf
54 role: ROLE_TEXT_LEAF,
55 name: "header1",
56 children: [ ]
57 }
58 ]
59 },
60 { // td@role="columnheader"
61 role: ROLE_COLUMNHEADER,
62 name: "header2",
63 children: [ { TEXT_LEAF: [ ] } ]
64 }
65 ]
66 }
67 ]
68 };
69 testAccessibleTree("crazy_grid1", accTree);
71 accTree = {
72 role: ROLE_TABLE,
73 children: [
74 { // tr@role="row"
75 role: ROLE_ROW,
76 tagName: "TR",
77 children: [
78 { // td generic accessible
79 role: ROLE_TEXT_CONTAINER,
80 children: [
81 { // td text leaf
82 role: ROLE_TEXT_LEAF,
83 name: "cell1",
84 children: [ ]
85 }
86 ]
87 },
88 { // td@role="gridcell"
89 role: ROLE_GRID_CELL,
90 name: "cell2",
91 children: [ { TEXT_LEAF: [ ] } ]
92 }
93 ]
94 }
95 ]
96 };
97 testAccessibleTree("crazy_grid2", accTree);
99 accTree = {
100 role: ROLE_TABLE,
101 children: [
102 { // div@role="row"
103 role: ROLE_ROW,
104 children: [
105 { // div@role="gridcell"
106 role: ROLE_GRID_CELL,
107 children: [
108 { // td generic accessible
109 role: ROLE_TEXT_CONTAINER,
110 children: [
111 { // text leaf from presentational table
112 role: ROLE_TEXT_LEAF,
113 name: "cell3",
114 children: [ ]
115 }
116 ]
117 },
118 ]
119 }
120 ]
121 }
122 ]
123 };
124 testAccessibleTree("crazy_grid3", accTree);
126 accTree = {
127 role: ROLE_TABLE,
128 children: [
129 { // div@role="row"
130 role: ROLE_ROW,
131 children: [
132 { // div@role="gridcell"
133 role: ROLE_GRID_CELL,
134 children: [
135 { // table
136 role: ROLE_TABLE,
137 children: [
138 { // tr
139 role: ROLE_ROW,
140 children: [
141 { // td
142 role: ROLE_CELL,
143 children: [
144 { // caption text leaf of presentational table
145 role: ROLE_TEXT_LEAF,
146 name: "caption",
147 children: [ ]
148 },
149 { // td generic accessible
150 role: ROLE_TEXT_CONTAINER,
151 children: [
152 { // td text leaf of presentational table
153 role: ROLE_TEXT_LEAF,
154 name: "cell4",
155 children: [ ]
156 }
157 ]
158 }
159 ]
160 }
161 ]
162 }
163 ]
164 }
165 ]
166 }
167 ]
168 }
169 ]
170 };
172 testAccessibleTree("crazy_grid4", accTree);
174 //////////////////////////////////////////////////////////////////////////
175 // grids that could contain whitespace accessibles but shouldn't.
177 var accTree =
178 { TREE_TABLE: [
179 { ROW: [
180 { GRID_CELL: [
181 { TEXT_LEAF: [ ] }
182 ] },
183 { GRID_CELL: [
184 { TEXT_LEAF: [ ] }
185 ] },
186 { GRID_CELL: [
187 { TEXT_LEAF: [ ] }
188 ] }
189 ] },
190 ] };
192 testAccessibleTree("whitespaces-grid", accTree);
194 SimpleTest.finish();
195 }
197 SimpleTest.waitForExplicitFinish();
198 addA11yLoadEvent(doTest);
199 </script>
200 </head>
201 <body>
203 <a target="_blank"
204 title="Support ARIA role rowgroup"
205 href="https://bugzilla.mozilla.org/show_bug.cgi?id=525909">
206 Mozilla Bug 525909
207 </a>
208 <p id="display"></p>
209 <div id="content" style="display: none"></div>
210 <pre id="test">
211 </pre>
213 <div id="grid" role="grid">
214 <div role="rowgroup">
215 <div role="row">
216 <div role="gridcell">cell</div>
217 </div>
218 </div>
219 </div>
221 <div id="crazy_grid1" role="grid">
222 <div role="row">
223 <table role="presentation">
224 <caption>caption</caption>
225 <tr>
226 <th>header1</th>
227 <td role="columnheader">header2</td>
228 </tr>
229 </table>
230 </div>
231 </div>
233 <div id="crazy_grid2" role="grid">
234 <table role="presentation">
235 <tr role="row">
236 <td id="ct_cell1">cell1</td>
237 <td role="gridcell">cell2</td>
238 </tr>
239 </table>
240 </div>
242 <div id="crazy_grid3" role="grid">
243 <div role="row">
244 <div role="gridcell">
245 <table role="presentation">
246 <tr>
247 <td>cell3</td>
248 </tr>
249 </table>
250 </div>
251 </div>
252 </div>
254 <div id="crazy_grid4" role="grid">
255 <div role="row">
256 <div role="gridcell">
257 <table>
258 <tr>
259 <td>
260 <table role="presentation">
261 <caption>caption</caption>
262 <tr><td>cell4</td></tr>
263 </table>
264 </td>
265 </tr>
266 </table>
267 </div>
268 </div>
269 </div>
271 <div role="treegrid" id="whitespaces-grid">
272 <div role="row" aria-selected="false" tabindex="-1">
273 <span role="gridcell">03:30PM-04:30PM</span>
274 <span role="gridcell" style="font-weight:bold;">test</span>
275 <span role="gridcell">a user1</span>
276 </div>
277 </div>
278 </body>
279 </html>