accessible/tests/mochitest/table/test_layoutguess.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 <html>
michael@0 2 <!-- https://bugzilla.mozilla.org/show_bug.cgi?id=495388 -->
michael@0 3 <head>
michael@0 4 <title>test HTMLTableAccessible::IsProbablyForLayout implementation</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="../attributes.js"></script>
michael@0 15
michael@0 16 <script type="application/javascript">
michael@0 17 function doTest()
michael@0 18 {
michael@0 19 // Attribute we're looking for
michael@0 20 var attr = {
michael@0 21 "layout-guess": "true"
michael@0 22 };
michael@0 23
michael@0 24 // table with role of grid
michael@0 25 testAbsentAttrs("table1", attr);
michael@0 26 // table with role of grid and datatable="0"
michael@0 27 testAbsentAttrs("table1.1", attr);
michael@0 28
michael@0 29 // table with landmark role
michael@0 30 testAbsentAttrs("table2", attr);
michael@0 31
michael@0 32 // table with summary
michael@0 33 testAbsentAttrs("table3", attr);
michael@0 34
michael@0 35 // table with caption
michael@0 36 testAbsentAttrs("table4", attr);
michael@0 37
michael@0 38 // layout table with empty caption
michael@0 39 testAttrs("table4.2", attr, true);
michael@0 40
michael@0 41 // table with thead element
michael@0 42 testAbsentAttrs("table5", attr);
michael@0 43
michael@0 44 // table with tfoot element
michael@0 45 testAbsentAttrs("table5.1", attr);
michael@0 46
michael@0 47 // table with colgroup or col elements
michael@0 48 testAbsentAttrs("table5.2", attr);
michael@0 49 testAbsentAttrs("table5.3", attr);
michael@0 50
michael@0 51 // table with th element
michael@0 52 testAbsentAttrs("table6", attr);
michael@0 53
michael@0 54 // table with headers attribute
michael@0 55 testAbsentAttrs("table6.2", attr);
michael@0 56
michael@0 57 // table with scope attribute
michael@0 58 testAbsentAttrs("table6.2.2", attr);
michael@0 59
michael@0 60 // table with abbr attribute
michael@0 61 testAbsentAttrs("table6.2.3", attr);
michael@0 62
michael@0 63 // table with abbr element
michael@0 64 testAbsentAttrs("table6.3", attr);
michael@0 65
michael@0 66 // table with abbr element having empty text node
michael@0 67 testAbsentAttrs("table6.4", attr);
michael@0 68
michael@0 69 // table with abbr element and non-empty text node
michael@0 70 testAttrs("table6.5", attr, true);
michael@0 71
michael@0 72 // layout table with nested table
michael@0 73 testAttrs("table9", attr, true);
michael@0 74
michael@0 75 // layout table with 1 column
michael@0 76 testAttrs("table10", attr, true);
michael@0 77
michael@0 78 // layout table with 1 row
michael@0 79 testAttrs("table11", attr, true);
michael@0 80
michael@0 81 // table with 5 columns
michael@0 82 testAbsentAttrs("table12", attr);
michael@0 83
michael@0 84 // table with a bordered cell
michael@0 85 testAbsentAttrs("table13", attr);
michael@0 86
michael@0 87 // table with alternating row background colors
michael@0 88 testAbsentAttrs("table14", attr);
michael@0 89
michael@0 90 // table with 3 columns and 21 rows
michael@0 91 testAbsentAttrs("table15", attr);
michael@0 92
michael@0 93 // layout table that has a 100% width
michael@0 94 testAttrs("table16", attr, true);
michael@0 95
michael@0 96 // layout table that has a 95% width in pixels
michael@0 97 testAttrs("table17", attr, true);
michael@0 98
michael@0 99 // layout table with less than 10 columns
michael@0 100 testAttrs("table18", attr, true);
michael@0 101
michael@0 102 // layout table with embedded iframe
michael@0 103 testAttrs("table19", attr, true);
michael@0 104
michael@0 105 // tree grid, no layout table
michael@0 106 testAbsentAttrs("table20", attr);
michael@0 107
michael@0 108 // layout table containing nested data table (having data structures)
michael@0 109 testAttrs("table21", attr, true);
michael@0 110 testAttrs("table21.2", attr, true);
michael@0 111 testAttrs("table21.3", attr, true);
michael@0 112 testAttrs("table21.4", attr, true);
michael@0 113 testAttrs("table21.5", attr, true);
michael@0 114 testAttrs("table21.6", attr, true);
michael@0 115
michael@0 116 // layout table having datatable="0" attribute and containing data table structure (tfoot element)
michael@0 117 testAttrs("table22", attr, true);
michael@0 118
michael@0 119 // css table with non-table tag
michael@0 120 testAttrs("table23", attr, true);
michael@0 121
michael@0 122 SimpleTest.finish();
michael@0 123 }
michael@0 124
michael@0 125 SimpleTest.waitForExplicitFinish();
michael@0 126 addA11yLoadEvent(doTest);
michael@0 127 </script>
michael@0 128 </head>
michael@0 129 <body>
michael@0 130
michael@0 131 <a target="_blank"
michael@0 132 href="https://bugzilla.mozilla.org/show_bug.cgi?id=495388"
michael@0 133 title="Don't treat tables that have a landmark role as layout table">
michael@0 134 Mozilla Bug 495388
michael@0 135 </a>
michael@0 136 <a target="_blank"
michael@0 137 href="https://bugzilla.mozilla.org/show_bug.cgi?id=690222"
michael@0 138 title="Data table elements used to determine layout-guess attribute shouldn't be picked from nested tables">
michael@0 139 Mozilla Bug 690222
michael@0 140 </a>
michael@0 141 <a target="_blank"
michael@0 142 href="https://bugzilla.mozilla.org/show_bug.cgi?id=693948"
michael@0 143 title="Expose layout-guess: true object attribute on CSS table accessible">
michael@0 144 Mozilla Bug 693948
michael@0 145 </a>
michael@0 146 <a target="_blank"
michael@0 147 href="https://bugzilla.mozilla.org/show_bug.cgi?id=696975"
michael@0 148 title="Extend the list of legitimate data table structures">
michael@0 149 Mozilla Bug 696975
michael@0 150 </a>
michael@0 151
michael@0 152 <p id="display"></p>
michael@0 153 <div id="content" style="display: none"></div>
michael@0 154 <pre id="test">
michael@0 155 </pre>
michael@0 156
michael@0 157 <!-- Table with role of grid -->
michael@0 158 <table id="table1" role="grid">
michael@0 159 <tr>
michael@0 160 <th>Sender</th>
michael@0 161 <th>Subject</th>
michael@0 162 <th>Date</th>
michael@0 163 </tr>
michael@0 164 <tr>
michael@0 165 <td>Marco</td>
michael@0 166 <td>Test</td>
michael@0 167 <td>June 12</td>
michael@0 168 </tr>
michael@0 169 <tr>
michael@0 170 <td>David</td>
michael@0 171 <td>Another test</td>
michael@0 172 <td>June 12</td>
michael@0 173 </tr>
michael@0 174 <tr>
michael@0 175 <td>Alex</td>
michael@0 176 <td>Third test</td>
michael@0 177 <td>June 12</td>
michael@0 178 </tr>
michael@0 179 </table>
michael@0 180 <!-- table with role of grid and datatable="0"-->
michael@0 181 <table id="table1.1" role="grid" datatable="0">
michael@0 182 <tr>
michael@0 183 <td>Cell1</td><td>cell2</td>
michael@0 184 </tr>
michael@0 185 </table>
michael@0 186
michael@0 187 <!-- table with landmark role -->
michael@0 188 <table id="table2" role="main">
michael@0 189 <tr>
michael@0 190 <th>Sender</th>
michael@0 191 <th>Subject</th>
michael@0 192 <th>Date</th>
michael@0 193 </tr>
michael@0 194 <tr>
michael@0 195 <td>Marco</td>
michael@0 196 <td>Test</td>
michael@0 197 <td>June 12</td>
michael@0 198 </tr>
michael@0 199 <tr>
michael@0 200 <td>David</td>
michael@0 201 <td>Another test</td>
michael@0 202 <td>June 12</td>
michael@0 203 </tr>
michael@0 204 <tr>
michael@0 205 <td>Alex</td>
michael@0 206 <td>Third test</td>
michael@0 207 <td>June 12</td>
michael@0 208 </tr>
michael@0 209 </table>
michael@0 210
michael@0 211 <!-- table with summary -->
michael@0 212 <table id="table3" summary="This is a table">
michael@0 213 <tr>
michael@0 214 <td>Cell1</td><td>cell2</td>
michael@0 215 </tr>
michael@0 216 </table>
michael@0 217
michael@0 218 <!-- table with caption -->
michael@0 219 <table id="table4">
michael@0 220 <caption>This is a table</caption>
michael@0 221 <tr>
michael@0 222 <td>Cell1</td><td>cell2</td>
michael@0 223 </tr>
michael@0 224 </table>
michael@0 225
michael@0 226 <!-- layout table with empty caption -->
michael@0 227 <table id="table4.2">
michael@0 228 <caption> </caption>
michael@0 229 <tr>
michael@0 230 <td>Cell1</td><td>cell2</td>
michael@0 231 </tr>
michael@0 232 </table>
michael@0 233
michael@0 234 <!-- table with thead element -->
michael@0 235 <table id="table5">
michael@0 236 <thead>
michael@0 237 <tr>
michael@0 238 <td>Cell1</td><td>cell2</td>
michael@0 239 </tr>
michael@0 240 </thead>
michael@0 241 </table>
michael@0 242
michael@0 243 <!-- table with tfoot element -->
michael@0 244 <table id="table5.1">
michael@0 245 <tfoot>
michael@0 246 <tr>
michael@0 247 <td>Cell1</td><td>cell2</td>
michael@0 248 </tr>
michael@0 249 </tfoot>
michael@0 250 </table>
michael@0 251
michael@0 252 <!-- table with colgroup and col elements -->
michael@0 253 <table id="table5.2">
michael@0 254 <colgroup width="20"></colgroup>
michael@0 255 <tr>
michael@0 256 <td>Cell1</td><td>cell2</td>
michael@0 257 </tr>
michael@0 258 </table>
michael@0 259 <table id="table5.3">
michael@0 260 <col width="20">
michael@0 261 <tr>
michael@0 262 <td>Cell1</td><td>cell2</td>
michael@0 263 </tr>
michael@0 264 </table>
michael@0 265
michael@0 266 <!-- table with th element -->
michael@0 267 <table id="table6">
michael@0 268 <tr>
michael@0 269 <th>Cell1</th><th>cell2</th>
michael@0 270 </tr>
michael@0 271 </table>
michael@0 272
michael@0 273 <!-- table with headers attribute -->
michael@0 274 <table id="table6.2">
michael@0 275 <tr>
michael@0 276 <td headers="a">table6.2 cell</td>
michael@0 277 </tr>
michael@0 278 </table>
michael@0 279
michael@0 280 <!-- table with scope attribute -->
michael@0 281 <table id="table6.2.2">
michael@0 282 <tr>
michael@0 283 <td scope="a">table6.2.2 cell</td>
michael@0 284 </tr>
michael@0 285 </table>
michael@0 286
michael@0 287 <!-- table with abbr attribute -->
michael@0 288 <table id="table6.2.3">
michael@0 289 <tr>
michael@0 290 <td abbr="table6.2.3">table6.2.3 cell1</td>
michael@0 291 </tr>
michael@0 292 </table>
michael@0 293
michael@0 294 <!-- table with abbr element -->
michael@0 295 <table id="table6.3">
michael@0 296 <tr>
michael@0 297 <td>table6.3 cell1</td>
michael@0 298 <td><abbr>table6.3 cell2</abbr></td>
michael@0 299 </tr>
michael@0 300 </table>
michael@0 301
michael@0 302 <!-- table with abbr element having empty text node -->
michael@0 303 <table id="table6.4">
michael@0 304 <tr>
michael@0 305 <td>
michael@0 306 <abbr>abbr</abbr>
michael@0 307 </td>
michael@0 308 </tr>
michael@0 309 </table>
michael@0 310
michael@0 311 <!-- table with abbr element and non-empty text node -->
michael@0 312 <table id="table6.5">
michael@0 313 <tr>
michael@0 314 <td>
michael@0 315 This is a really long text (<abbr>tiarlt</abbr>) inside layout table
michael@0 316 </td>
michael@0 317 </tr>
michael@0 318 </table>
michael@0 319
michael@0 320 <!-- layout table with nested table -->
michael@0 321 <table id="table9">
michael@0 322 <tr>
michael@0 323 <td><table><tr><td>Cell</td></tr></table></td>
michael@0 324 </tr>
michael@0 325 </table>
michael@0 326
michael@0 327 <!-- layout table with 1 column -->
michael@0 328 <table id="table10">
michael@0 329 <tr><td>Row1</td></tr>
michael@0 330 <tr><td>Row2</td></tr>
michael@0 331 </table>
michael@0 332
michael@0 333 <!-- layout table with 1 row and purposely many columns -->
michael@0 334 <table id="table11">
michael@0 335 <tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
michael@0 336 </table>
michael@0 337
michael@0 338 <!-- table with 5 columns -->
michael@0 339 <table id="table12">
michael@0 340 <tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
michael@0 341 <tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
michael@0 342 </table>
michael@0 343
michael@0 344 <!-- table with a bordered cell -->
michael@0 345 <table id="table13" border="1" width="100%" bordercolor="#0000FF">
michael@0 346 <tr>
michael@0 347 <td bordercolor="#000000"> </td>
michael@0 348 <td bordercolor="#000000"> </td>
michael@0 349 <td bordercolor="#000000"> </td>
michael@0 350 </tr>
michael@0 351 <tr>
michael@0 352 <td bordercolor="#000000"> </td>
michael@0 353 <td bordercolor="#000000"> </td>
michael@0 354 <td bordercolor="#000000"> </td>
michael@0 355 </tr>
michael@0 356 </table>
michael@0 357
michael@0 358 <!-- table with alternating row background colors -->
michael@0 359 <table id="table14" width="100%">
michael@0 360 <tr style="background-color: #0000FF;">
michael@0 361 <td> </td>
michael@0 362 <td> </td>
michael@0 363 <td> </td>
michael@0 364 </tr>
michael@0 365 <tr style="background-color: #00FF00;">
michael@0 366 <td> </td>
michael@0 367 <td> </td>
michael@0 368 <td> </td>
michael@0 369 </tr>
michael@0 370 </table>
michael@0 371
michael@0 372 <!-- table with 3 columns and 21 rows -->
michael@0 373 <table id="table15" border="0">
michael@0 374 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 375 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 376 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 377 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 378 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 379 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 380 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 381 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 382 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 383 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 384 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 385 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 386 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 387 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 388 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 389 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 390 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 391 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 392 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 393 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 394 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 395 </table>
michael@0 396
michael@0 397 <!-- layout table that has a 100% width -->
michael@0 398 <table id="table16" width="100%">
michael@0 399 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 400 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 401 </table>
michael@0 402
michael@0 403 <!-- layout table that has a 95% width in pixels -->
michael@0 404 <table id="table17" width="98%">
michael@0 405 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 406 <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
michael@0 407 </table>
michael@0 408
michael@0 409 <!-- layout table with less than 10 columns -->
michael@0 410 <table id="table18">
michael@0 411 <tr>
michael@0 412 <td>Marco</td>
michael@0 413 <td>Test</td>
michael@0 414 <td>June 12</td>
michael@0 415 </tr>
michael@0 416 <tr>
michael@0 417 <td>David</td>
michael@0 418 <td>Another test</td>
michael@0 419 <td>June 12</td>
michael@0 420 </tr>
michael@0 421 <tr>
michael@0 422 <td>Alex</td>
michael@0 423 <td>Third test</td>
michael@0 424 <td>June 12</td>
michael@0 425 </tr>
michael@0 426 </table>
michael@0 427
michael@0 428 <!-- layout table with embedded iframe -->
michael@0 429 <table id="table19">
michael@0 430 <tr><td><iframe id="frame"></iframe></td><td> </td><td> </td></tr>
michael@0 431 <tr><td> </td><td> </td><td> </td></tr>
michael@0 432 <tr><td> </td><td> </td><td> </td></tr>
michael@0 433 <tr><td> </td><td> </td><td> </td></tr>
michael@0 434 </table>
michael@0 435
michael@0 436 <!-- tree grid, no layout table -->
michael@0 437 <table id="table20" role="treegrid">
michael@0 438 <tr role="treeitem"><td>Cell1</td><td>Cell2</td></tr>
michael@0 439 </table>
michael@0 440
michael@0 441 <!-- layout table with nested data table containing data table elements -->
michael@0 442 <table id="table21">
michael@0 443 <tr>
michael@0 444 <td>
michael@0 445 <table>
michael@0 446 <caption>table</caption>
michael@0 447 <tr><td>Cell</td></tr>
michael@0 448 </table>
michael@0 449 </td>
michael@0 450 </tr>
michael@0 451 </table>
michael@0 452 <table id="table21.2">
michael@0 453 <tr>
michael@0 454 <td>
michael@0 455 <table>
michael@0 456 <colgroup width="20"></colgroup>
michael@0 457 <tr><th>Cell</th></tr>
michael@0 458 </table>
michael@0 459 </td>
michael@0 460 </tr>
michael@0 461 </table>
michael@0 462 <table id="table21.3">
michael@0 463 <tr>
michael@0 464 <td>
michael@0 465 <table>
michael@0 466 <col width="20"></col>
michael@0 467 <tr><th>Cell</th></tr>
michael@0 468 </table>
michael@0 469 </td>
michael@0 470 </tr>
michael@0 471 </table>
michael@0 472 <table id="table21.4">
michael@0 473 <tr>
michael@0 474 <td>
michael@0 475 <table>
michael@0 476 <tr><th>Cell</th></tr>
michael@0 477 </table>
michael@0 478 </td>
michael@0 479 </tr>
michael@0 480 </table>
michael@0 481 <table id="table21.5">
michael@0 482 <tr>
michael@0 483 <td>
michael@0 484 <table>
michael@0 485 <thead>
michael@0 486 <tr><td>Cell</td></tr>
michael@0 487 </thead>
michael@0 488 </table>
michael@0 489 </td>
michael@0 490 </tr>
michael@0 491 </table>
michael@0 492 <table id="table21.6">
michael@0 493 <tr>
michael@0 494 <td>
michael@0 495 <table>
michael@0 496 <tfoot>
michael@0 497 <tr><td>Cell</td></tr>
michael@0 498 </tfoot>
michael@0 499 </table>
michael@0 500 </td>
michael@0 501 </tr>
michael@0 502 </table>
michael@0 503
michael@0 504 <!-- layout table with datatable="0" and tfoot element-->
michael@0 505 <table id="table22" datatable="0">
michael@0 506 <tfoot>
michael@0 507 <tr>
michael@0 508 <td>Cell1</td><td>cell2</td>
michael@0 509 </tr>
michael@0 510 </tfoot>
michael@0 511 </table>
michael@0 512
michael@0 513 <!-- css table with noon-table tag -->
michael@0 514 <div id="table23" style="display:table;">
michael@0 515 <div style="display:table-row;">
michael@0 516 <div style="display:table-cell;">Row 1, column 1</div>
michael@0 517 <div style="display:table-cell;">Row 1, column 2</div>
michael@0 518 <div style="display:table-cell;">Row 1, column 3</div>
michael@0 519 </div>
michael@0 520 </div>
michael@0 521 </body>
michael@0 522 </html>

mercurial