accessible/tests/mochitest/tree/test_aria_grid.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial