accessible/tests/mochitest/relations/test_general.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
michael@0 3 <head>
michael@0 4 <title>nsIAccessible::getAccessibleRelated() tests</title>
michael@0 5 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 6
michael@0 7 <script type="application/javascript"
michael@0 8 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9
michael@0 10 <script type="application/javascript"
michael@0 11 src="../common.js"></script>
michael@0 12 <script type="application/javascript"
michael@0 13 src="../relations.js"></script>
michael@0 14 <script type="application/javascript"
michael@0 15 src="../role.js"></script>
michael@0 16
michael@0 17 <script type="application/javascript">
michael@0 18 function doTest()
michael@0 19 {
michael@0 20 // html:label@for
michael@0 21 testRelation("label1_1", RELATION_LABEL_FOR, "control1_1");
michael@0 22 testRelation("control1_1", RELATION_LABELLED_BY, "label1_1");
michael@0 23
michael@0 24 // html:label@for, multiple
michael@0 25 testRelation("label1_2", RELATION_LABEL_FOR, "control1_2");
michael@0 26 testRelation("label1_3", RELATION_LABEL_FOR, "control1_2");
michael@0 27 testRelation("control1_2", RELATION_LABELLED_BY,
michael@0 28 [ "label1_2", "label1_3" ]);
michael@0 29
michael@0 30 // ancestor html:label (implicit association)
michael@0 31 testRelation("label1_4", RELATION_LABEL_FOR, "control1_4");
michael@0 32 testRelation("control1_4", RELATION_LABELLED_BY, "label1_4");
michael@0 33 testRelation("control1_4_option1", RELATION_LABELLED_BY, null);
michael@0 34 testRelation("label1_5", RELATION_LABEL_FOR, "control1_5");
michael@0 35 testRelation("control1_5", RELATION_LABELLED_BY, "label1_5");
michael@0 36 testRelation("label1_6", RELATION_LABEL_FOR, "control1_6");
michael@0 37 testRelation("control1_6", RELATION_LABELLED_BY, "label1_6");
michael@0 38 testRelation("label1_7", RELATION_LABEL_FOR, "control1_7");
michael@0 39 testRelation("control1_7", RELATION_LABELLED_BY, "label1_7");
michael@0 40 testRelation("label1_8", RELATION_LABEL_FOR, "control1_8");
michael@0 41 testRelation("control1_8", RELATION_LABELLED_BY, "label1_8");
michael@0 42 testRelation("label1_9", RELATION_LABEL_FOR, "control1_9");
michael@0 43 testRelation("control1_9", RELATION_LABELLED_BY, "label1_9");
michael@0 44 testRelation("label1_10", RELATION_LABEL_FOR, "control1_10");
michael@0 45 testRelation("control1_10", RELATION_LABELLED_BY, "label1_10");
michael@0 46 testRelation("label1_11", RELATION_LABEL_FOR, "control1_11");
michael@0 47 testRelation("control1_11", RELATION_LABELLED_BY, "label1_11");
michael@0 48 testRelation("label1_12", RELATION_LABEL_FOR, "control1_12");
michael@0 49 testRelation("control1_12", RELATION_LABELLED_BY, "label1_12");
michael@0 50
michael@0 51 testRelation("label1_13", RELATION_LABEL_FOR, null);
michael@0 52 testRelation("control1_13", RELATION_LABELLED_BY, null);
michael@0 53 testRelation("control1_14", RELATION_LABELLED_BY, "label1_14");
michael@0 54
michael@0 55 // aria-labelledby
michael@0 56 testRelation("label2", RELATION_LABEL_FOR, "checkbox2");
michael@0 57 testRelation("checkbox2", RELATION_LABELLED_BY, "label2");
michael@0 58
michael@0 59 // aria-labelledby, multiple relations
michael@0 60 testRelation("label3", RELATION_LABEL_FOR, "checkbox3");
michael@0 61 testRelation("label4", RELATION_LABEL_FOR, "checkbox3");
michael@0 62 testRelation("checkbox3", RELATION_LABELLED_BY, ["label3", "label4"]);
michael@0 63
michael@0 64 // aria-describedby
michael@0 65 testRelation("descr1", RELATION_DESCRIPTION_FOR, "checkbox4");
michael@0 66 testRelation("checkbox4", RELATION_DESCRIBED_BY, "descr1");
michael@0 67
michael@0 68 // aria-describedby, multiple relations
michael@0 69 testRelation("descr2", RELATION_DESCRIPTION_FOR, "checkbox5");
michael@0 70 testRelation("descr3", RELATION_DESCRIPTION_FOR, "checkbox5");
michael@0 71 testRelation("checkbox5", RELATION_DESCRIBED_BY, ["descr2", "descr3"]);
michael@0 72
michael@0 73 // aria_owns, multiple relations
michael@0 74 testRelation("treeitem1", RELATION_NODE_CHILD_OF, "tree");
michael@0 75 testRelation("treeitem2", RELATION_NODE_CHILD_OF, "tree");
michael@0 76
michael@0 77 // 'node child of' relation for outlineitem role
michael@0 78 testRelation("treeitem3", RELATION_NODE_CHILD_OF, "tree");
michael@0 79 testRelation("treeitem4", RELATION_NODE_CHILD_OF, "tree");
michael@0 80 testRelation("treeitem5", RELATION_NODE_CHILD_OF, "treeitem4");
michael@0 81 testRelation("treeitem6", RELATION_NODE_CHILD_OF, "tree");
michael@0 82 testRelation("treeitem7", RELATION_NODE_CHILD_OF, "treeitem6");
michael@0 83 testRelation("tree2_ti1", RELATION_NODE_CHILD_OF, "tree2");
michael@0 84 testRelation("tree2_ti1a", RELATION_NODE_CHILD_OF, "tree2_ti1");
michael@0 85 testRelation("tree2_ti1b", RELATION_NODE_CHILD_OF, "tree2_ti1");
michael@0 86
michael@0 87 // 'node child of' relation for row role in grid.
michael@0 88 // Relation for row associated using aria-owns should exist.
michael@0 89 testRelation("simplegrid-ownrow", RELATION_NODE_CHILD_OF, "simplegrid");
michael@0 90 // Relation for row associated using aria-level should exist.
michael@0 91 testRelation("simplegrid-row3", RELATION_NODE_CHILD_OF,
michael@0 92 "simplegrid-row2");
michael@0 93 // Relations for hierarchical children elements shouldn't exist.
michael@0 94 testAbsentRelation("simplegrid-row1", RELATION_NODE_CHILD_OF,
michael@0 95 "simplegrid");
michael@0 96 testAbsentRelation("simplegrid-row2", RELATION_NODE_CHILD_OF,
michael@0 97 "simplegrid");
michael@0 98
michael@0 99 // 'node child of' relation for row role of treegrid
michael@0 100 testRelation("treegridrow1", RELATION_NODE_CHILD_OF, "treegrid");
michael@0 101 testRelation("treegridrow2", RELATION_NODE_CHILD_OF, "treegrid");
michael@0 102 testRelation("treegridrow3", RELATION_NODE_CHILD_OF, "treegridrow2");
michael@0 103
michael@0 104 // 'node child of' relation for lists organized by groups
michael@0 105 testRelation("listitem1", RELATION_NODE_CHILD_OF, "list");
michael@0 106 testRelation("listitem1.1", RELATION_NODE_CHILD_OF, "listitem1");
michael@0 107 testRelation("listitem1.2", RELATION_NODE_CHILD_OF, "listitem1");
michael@0 108
michael@0 109 // 'node child of' relation for the document having window, returns
michael@0 110 // direct accessible parent (fixed in bug 419770).
michael@0 111 var iframeElmObj = {};
michael@0 112 var iframeAcc = getAccessible("iframe", null, iframeElmObj);
michael@0 113 var iframeDoc = iframeElmObj.value.contentDocument;
michael@0 114 var iframeDocAcc = getAccessible(iframeDoc);
michael@0 115 testRelation(iframeDocAcc, RELATION_NODE_CHILD_OF, iframeAcc);
michael@0 116
michael@0 117 // 'node parent of' relation on ARIA tree and treegrid.
michael@0 118 testRelation("tree", RELATION_NODE_PARENT_OF,
michael@0 119 ["treeitem1", "treeitem2", // aria-owns
michael@0 120 "treeitem3", "treeitem4", "treeitem6"]); // children
michael@0 121 testRelation("treeitem4", RELATION_NODE_PARENT_OF,
michael@0 122 "treeitem5"); // aria-level
michael@0 123 testRelation("treeitem6", RELATION_NODE_PARENT_OF,
michael@0 124 "treeitem7"); // // group role
michael@0 125 testRelation("tree2", RELATION_NODE_PARENT_OF, "tree2_ti1"); // group role
michael@0 126 testRelation("tree2_ti1", RELATION_NODE_PARENT_OF,
michael@0 127 ["tree2_ti1a", "tree2_ti1b"]); // group role
michael@0 128
michael@0 129 testRelation("treegridrow2", RELATION_NODE_PARENT_OF, "treegridrow3");
michael@0 130 testRelation("treegrid", RELATION_NODE_PARENT_OF,
michael@0 131 ["treegridrow1", "treegridrow2"]);
michael@0 132
michael@0 133 // 'node parent of' relation on ARIA grid.
michael@0 134 // Should only have relation to child added through aria-owns.
michael@0 135 testRelation("simplegrid", RELATION_NODE_PARENT_OF, "simplegrid-ownrow");
michael@0 136 // 'node parent of' relation on ARIA grid's row.
michael@0 137 // Should only have relation to child through aria-level.
michael@0 138 testRelation("simplegrid-row2", RELATION_NODE_PARENT_OF,
michael@0 139 "simplegrid-row3");
michael@0 140
michael@0 141 // 'node parent of' relation on ARIA list structured by groups
michael@0 142 testRelation("list", RELATION_NODE_PARENT_OF,
michael@0 143 "listitem1");
michael@0 144 testRelation("listitem1", RELATION_NODE_PARENT_OF,
michael@0 145 [ "listitem1.1", "listitem1.2" ]);
michael@0 146
michael@0 147 // aria-atomic
michael@0 148 testRelation(getNode("atomic").firstChild, RELATION_MEMBER_OF, "atomic");
michael@0 149
michael@0 150 // aria-controls
michael@0 151 getAccessible("tab");
michael@0 152 todo(false,
michael@0 153 "Getting an accessible tab, otherwise relations for tabpanel aren't cached. Bug 606924 will fix that.");
michael@0 154 testRelation("tabpanel", RELATION_CONTROLLED_BY, "tab");
michael@0 155 testRelation("tab", RELATION_CONTROLLER_FOR, "tabpanel");
michael@0 156
michael@0 157 // aria-controls, multiple relations
michael@0 158 testRelation("lr1", RELATION_CONTROLLED_BY, "button");
michael@0 159 testRelation("lr2", RELATION_CONTROLLED_BY, "button");
michael@0 160 testRelation("button", RELATION_CONTROLLER_FOR, ["lr1", "lr2"]);
michael@0 161
michael@0 162 // aria-flowto
michael@0 163 testRelation("flowto", RELATION_FLOWS_TO, "flowfrom");
michael@0 164 testRelation("flowfrom", RELATION_FLOWS_FROM, "flowto");
michael@0 165
michael@0 166 // aria-flowto, multiple relations
michael@0 167 testRelation("flowto1", RELATION_FLOWS_TO, ["flowfrom1", "flowfrom2"]);
michael@0 168 testRelation("flowfrom1", RELATION_FLOWS_FROM, "flowto1");
michael@0 169 testRelation("flowfrom2", RELATION_FLOWS_FROM, "flowto1");
michael@0 170
michael@0 171 // 'default button' relation
michael@0 172 testRelation("input", RELATION_DEFAULT_BUTTON, "submit");
michael@0 173
michael@0 174 // output 'for' relations
michael@0 175 testRelation("output", RELATION_CONTROLLED_BY, ["input", "input2"]);
michael@0 176 testRelation("output2", RELATION_CONTROLLED_BY, ["input", "input2"]);
michael@0 177 testRelation("input", RELATION_CONTROLLER_FOR, ["output", "output2"]);
michael@0 178 testRelation("input2", RELATION_CONTROLLER_FOR, ["output", "output2"]);
michael@0 179
michael@0 180 // 'described by'/'description for' relation for html:table and
michael@0 181 // html:caption
michael@0 182 testRelation("caption", RELATION_LABEL_FOR, "table");
michael@0 183 testRelation("table", RELATION_LABELLED_BY, "caption");
michael@0 184
michael@0 185 // 'labelled by'/'label for' relation for html:fieldset and
michael@0 186 // html:legend
michael@0 187 testRelation("legend", RELATION_LABEL_FOR, "fieldset");
michael@0 188 testRelation("fieldset", RELATION_LABELLED_BY, "legend");
michael@0 189
michael@0 190 // containing relations
michael@0 191 testRelation("control1_1", RELATION_CONTAINING_DOCUMENT, document);
michael@0 192 testRelation("control1_1", RELATION_CONTAINING_TAB_PANE, getTabDocAccessible("control1_1"));
michael@0 193 testRelation("control1_1", RELATION_CONTAINING_APPLICATION, getApplicationAccessible());
michael@0 194
michael@0 195 // finish test
michael@0 196 SimpleTest.finish();
michael@0 197 }
michael@0 198
michael@0 199 disableLogging(); // from test_embeds.xul
michael@0 200 SimpleTest.waitForExplicitFinish();
michael@0 201 addA11yLoadEvent(doTest);
michael@0 202 </script>
michael@0 203
michael@0 204 </head>
michael@0 205
michael@0 206 <body>
michael@0 207
michael@0 208 <a target="_blank"
michael@0 209 href="https://bugzilla.mozilla.org/show_bug.cgi?id=475298"
michael@0 210 title="mochitests for accessible relations">
michael@0 211 Bug 475298
michael@0 212 </a>
michael@0 213 <a target="_blank"
michael@0 214 href="https://bugzilla.mozilla.org/show_bug.cgi?id=527461"
michael@0 215 title="Implement RELATION_NODE_PARENT_OF">
michael@0 216 Bug 527461
michael@0 217 </a>
michael@0 218 <a target="_blank"
michael@0 219 href="https://bugzilla.mozilla.org/show_bug.cgi?id=558036"
michael@0 220 title="make HTML <output> accessible">
michael@0 221 Bug 558036
michael@0 222 </a>
michael@0 223 <a target="_blank"
michael@0 224 href="https://bugzilla.mozilla.org/show_bug.cgi?id=682790"
michael@0 225 title="Ignore implicit label association when it's associated explicitly">
michael@0 226 Bug 682790
michael@0 227 </a>
michael@0 228 <a target="_blank"
michael@0 229 href="https://bugzilla.mozilla.org/show_bug.cgi?id=687393"
michael@0 230 title="HTML select options gets relation from containing label">
michael@0 231 Bug 687393
michael@0 232 </a>
michael@0 233 <a target="_blank"
michael@0 234 href="https://bugzilla.mozilla.org/show_bug.cgi?id=864224"
michael@0 235 title="Support nested ARIA listitems structured by role='group'">
michael@0 236 Bug 864224
michael@0 237 </a>
michael@0 238 <p id="display"></p>
michael@0 239 <div id="content" style="display: none"></div>
michael@0 240 <pre id="test">
michael@0 241 </pre>
michael@0 242
michael@0 243 <label id="label1_1" for="control1_1">label</label>
michael@0 244 <input id="control1_1">
michael@0 245
michael@0 246 <label id="label1_2" for="control1_2">label</label>
michael@0 247 <label id="label1_3" for="control1_2">label</label>
michael@0 248 <input id="control1_2">
michael@0 249
michael@0 250 <label id="label1_4">Label
michael@0 251 <select id="control1_4">
michael@0 252 <option id="control1_4_option1">option</option>
michael@0 253 </select>
michael@0 254 </label>
michael@0 255 <label id="label1_5">Label
michael@0 256 <button id="control1_5">button</button>
michael@0 257 </label>
michael@0 258 <label id="label1_6">Label
michael@0 259 <input id="control1_6">
michael@0 260 </label>
michael@0 261 <label id="label1_7">Label
michael@0 262 <input id="control1_7" type="checkbox">
michael@0 263 </label>
michael@0 264 <label id="label1_8">Label
michael@0 265 <input id="control1_8" type="radio">
michael@0 266 </label>
michael@0 267 <label id="label1_9">Label
michael@0 268 <input id="control1_9" type="button" value="button">
michael@0 269 </label>
michael@0 270 <label id="label1_10">Label
michael@0 271 <input id="control1_10" type="submit">
michael@0 272 </label>
michael@0 273 <label id="label1_11">Label
michael@0 274 <input id="control1_11" type="image">
michael@0 275 </label>
michael@0 276 <label id="label1_12">Label
michael@0 277 <progress id="control1_12"></progress>
michael@0 278 </label>
michael@0 279
michael@0 280 <label id="label1_13" for="">Label
michael@0 281 <input id="control1_13">
michael@0 282 </label>
michael@0 283 <label id="label1_14" for="control1_14">Label
michael@0 284 <input id="control1_14">
michael@0 285 </label>
michael@0 286
michael@0 287 <span id="label2">label</span>
michael@0 288 <span role="checkbox" id="checkbox2" aria-labelledby="label2"></span>
michael@0 289
michael@0 290 <span id="label3">label1</span>
michael@0 291 <span id="label4">label2</span>
michael@0 292 <span role="checkbox" id="checkbox3" aria-labelledby="label3 label4"></span>
michael@0 293
michael@0 294 <span id="descr1">description</span>
michael@0 295 <span role="checkbox" id="checkbox4" aria-describedby="descr1"></span>
michael@0 296
michael@0 297 <span id="descr2">description1</span>
michael@0 298 <span id="descr3">description2</span>
michael@0 299 <span role="checkbox" id="checkbox5" aria-describedby="descr2 descr3"></span>
michael@0 300
michael@0 301 <div role="treeitem" id="treeitem1">Yellow</div>
michael@0 302 <div role="treeitem" id="treeitem2">Orange</div>
michael@0 303 <div id="tree" role="tree" aria-owns="treeitem1 treeitem2">
michael@0 304 <div role="treeitem" id="treeitem3">Blue</div>
michael@0 305 <div role="treeitem" id="treeitem4" aria-level="1">Green</div>
michael@0 306 <div role="treeitem" id="treeitem5" aria-level="2">Light green</div>
michael@0 307 <div role="treeitem" id="treeitem6" aria-level="1">Green2</div>
michael@0 308 <div role="group">
michael@0 309 <div role="treeitem" id="treeitem7">Super light green</div>
michael@0 310 </div>
michael@0 311 </div>
michael@0 312
michael@0 313 <div aria-owns="simplegrid-ownrow" role="grid" id="simplegrid">
michael@0 314 <div role="row" id="simplegrid-row1" aria-level="1">
michael@0 315 <div role="gridcell">cell 1,1</div>
michael@0 316 <div role="gridcell">cell 1,2</div>
michael@0 317 </div>
michael@0 318 <div role="row" id="simplegrid-row2" aria-level="1">
michael@0 319 <div role="gridcell">cell 2,1</div>
michael@0 320 <div role="gridcell">cell 2,2</div>
michael@0 321 </div>
michael@0 322 <div role="row" id="simplegrid-row3" aria-level="2">
michael@0 323 <div role="gridcell">cell 3,1</div>
michael@0 324 <div role="gridcell">cell 3,2</div>
michael@0 325 </div>
michael@0 326 </div>
michael@0 327 <div role="row" id="simplegrid-ownrow"></div>
michael@0 328
michael@0 329 <ul role="tree" id="tree2">
michael@0 330 <li role="treeitem" id="tree2_ti1">Item 1
michael@0 331 <ul role="group">
michael@0 332 <li role="treeitem" id="tree2_ti1a">Item 1A</li>
michael@0 333 <li role="treeitem" id="tree2_ti1b">Item 1B</li>
michael@0 334 </ul>
michael@0 335 </li>
michael@0 336 </ul>
michael@0 337
michael@0 338 <div role="treegrid" id="treegrid">
michael@0 339 <div role="row" id="treegridrow1">
michael@0 340 <span role="gridcell">cell1</span><span role="gridcell">cell2</span>
michael@0 341 </div>
michael@0 342 <div role="row" id="treegridrow2" aria-level="1">
michael@0 343 <span role="gridcell">cell3</span><span role="gridcell">cell4</span>
michael@0 344 </div>
michael@0 345 <div role="row" id="treegridrow3" aria-level="2">
michael@0 346 <span role="gridcell">cell5</span><span role="gridcell">cell6</span>
michael@0 347 </div>
michael@0 348 </div>
michael@0 349
michael@0 350 <div role="list" id="list">
michael@0 351 <div role="listitem" id="listitem1">Item 1
michael@0 352 <div role="group">
michael@0 353 <div role="listitem" id="listitem1.1">Item 1A</div>
michael@0 354 <div role="listitem" id="listitem1.2">Item 1B</div>
michael@0 355 </div>
michael@0 356 </div>
michael@0 357 </div>
michael@0 358
michael@0 359 <iframe id="iframe"></iframe>
michael@0 360
michael@0 361 <div id="tablist" role="tablist">
michael@0 362 <div id="tab" role="tab" aria-controls="tabpanel">tab</div>
michael@0 363 </div>
michael@0 364 <div id="tabpanel" role="tabpanel">tabpanel</div>
michael@0 365
michael@0 366 <div id="lr1" aria-live="assertive">1</div>
michael@0 367 <div id="lr2" aria-live="assertive">a</div>
michael@0 368 <input type="button" id="button" aria-controls="lr1 lr2"
michael@0 369 onclick="getNode('lr1').textContent += '1'; getNode('lr2').textContent += 'a';"/>
michael@0 370
michael@0 371 <div id="atomic" aria-atomic="true">live region</div>
michael@0 372
michael@0 373 <span id="flowto" aria-flowto="flowfrom">flow to</span>
michael@0 374 <span id="flowfrom">flow from</span>
michael@0 375
michael@0 376 <span id="flowto1" aria-flowto="flowfrom1 flowfrom2">flow to</span>
michael@0 377 <span id="flowfrom1">flow from</span>
michael@0 378 <span id="flowfrom2">flow from</span>
michael@0 379
michael@0 380 <form id="form">
michael@0 381 <input id="input" />
michael@0 382 <input id="input2" />
michael@0 383 <input type="submit" id="submit" />
michael@0 384 <output id="output" style="display:block" for="input input2"></output>
michael@0 385 <output id="output2" for="input input2"></output>
michael@0 386 </form>
michael@0 387
michael@0 388 <table id="table">
michael@0 389 <caption id="caption">tabple caption</caption>
michael@0 390 <tr>
michael@0 391 <td>cell1</td><td>cell2</td>
michael@0 392 </tr>
michael@0 393 </table>
michael@0 394
michael@0 395 <fieldset id="fieldset">
michael@0 396 <legend id="legend">legend</legend>
michael@0 397 <input />
michael@0 398 </fieldset>
michael@0 399 </body>
michael@0 400 </html>

mercurial