accessible/tests/mochitest/jsat/test_explicit_names.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 <head>
michael@0 3 <title>[AccessFu] Trust explicitly associated names when speaking certain elements</title>
michael@0 4
michael@0 5 <link rel="stylesheet" type="text/css"
michael@0 6 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 7 <script type="application/javascript"
michael@0 8 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="application/javascript"
michael@0 10 src="../common.js"></script>
michael@0 11 <script type="application/javascript"
michael@0 12 src="output.js"></script>
michael@0 13 <script type="application/javascript">
michael@0 14
michael@0 15 function doTest() {
michael@0 16 // Test the following accOrElmOrID.
michael@0 17 var tests = [{
michael@0 18 accOrElmOrID: "anchor1",
michael@0 19 expected: ["link", "title"]
michael@0 20 }, {
michael@0 21 accOrElmOrID: "anchor2",
michael@0 22 expected: ["link", "This is a link"]
michael@0 23 }, {
michael@0 24 accOrElmOrID: "button1",
michael@0 25 expected: ["button", "Press me"]
michael@0 26 }, {
michael@0 27 accOrElmOrID: "button2",
michael@0 28 expected: ["button", "Press me"]
michael@0 29 }, {
michael@0 30 accOrElmOrID: "textarea1",
michael@0 31 expected: ["text area", "This is the text area text.", "Test Text Area"]
michael@0 32 }, {
michael@0 33 accOrElmOrID: "textarea2",
michael@0 34 expected: ["text area", "This is the text area text."]
michael@0 35 }, {
michael@0 36 accOrElmOrID: "heading1",
michael@0 37 expected: ["heading level 1", "Test heading", "This is the heading."]
michael@0 38 }, {
michael@0 39 accOrElmOrID: "heading1",
michael@0 40 oldAccOrElmOrID: null,
michael@0 41 expected: [null /* parent doc title */, document.title,
michael@0 42 "heading level 1", "Test heading", "This is the heading."]
michael@0 43 }, {
michael@0 44 accOrElmOrID: "heading2",
michael@0 45 expected: ["heading level 1", "This is the heading."]
michael@0 46 }, {
michael@0 47 accOrElmOrID: "list",
michael@0 48 expected: ["list 2 items", "Test List", "First item", "Top of the list",
michael@0 49 "Last item", "2.", "list two"]
michael@0 50 }, {
michael@0 51 accOrElmOrID: "dlist",
michael@0 52 expected: ["definition list 0.5 items", "Test Definition List",
michael@0 53 "dd one"]
michael@0 54 }, {
michael@0 55 accOrElmOrID: "li_one",
michael@0 56 expected: ["list 2 items", "Test List", "First item", "Top of the list"]
michael@0 57 }, {
michael@0 58 accOrElmOrID: "li_two",
michael@0 59 expected: ["list 2 items", "Test List", "Last item", "2.", "list two"]
michael@0 60 }, {
michael@0 61 accOrElmOrID: "cell",
michael@0 62 expected: ["table with 1 column and 1 row", "Fruits and vegetables",
michael@0 63 "Column 1 Row 1", "List of Fruits", "list 4 items", "First item",
michael@0 64 "link", "Apples", "link", "Bananas", "link", "Peaches", "Last item",
michael@0 65 "link", "Plums"]
michael@0 66 }, {
michael@0 67 accOrElmOrID: "app.net",
michael@0 68 expected: ["list 2 items", "First item", "link", "star", "Last item",
michael@0 69 "link", "repost"]
michael@0 70 }, {
michael@0 71 // Test pivot to list from li_one.
michael@0 72 accOrElmOrID: "list",
michael@0 73 oldAccOrElmOrID: "li_one",
michael@0 74 expected: ["list 2 items", "Test List", "First item", "Top of the list",
michael@0 75 "Last item", "2.", "list two"]
michael@0 76 }, {
michael@0 77 // Test pivot to li_one from list.
michael@0 78 accOrElmOrID: "li_one",
michael@0 79 oldAccOrElmOrID: "list",
michael@0 80 expected: ["First item", "Top of the list"]
michael@0 81 }, {
michael@0 82 // Test pivot to "apples" link from the table cell.
michael@0 83 accOrElmOrID: "apples",
michael@0 84 oldAccOrElmOrID: "cell",
michael@0 85 expected: ["list 4 items", "First item", "link", "Apples"]
michael@0 86 }, {
michael@0 87 // Test pivot to the table cell from the "apples" link.
michael@0 88 accOrElmOrID: "cell",
michael@0 89 oldAccOrElmOrID: "apples",
michael@0 90 expected: ["List of Fruits", "list 4 items", "First item", "link",
michael@0 91 "Apples", "link", "Bananas", "link", "Peaches", "Last item", "link",
michael@0 92 "Plums"]
michael@0 93 }];
michael@0 94
michael@0 95 SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);
michael@0 96
michael@0 97 // Test various explicit names vs the utterance generated from subtrees.
michael@0 98 tests.forEach(function run(test) {
michael@0 99 testOutput(test.expected, test.accOrElmOrID, test.oldAccOrElmOrID, 1);
michael@0 100 });
michael@0 101
michael@0 102 SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
michael@0 103 SimpleTest.finish();
michael@0 104 }
michael@0 105
michael@0 106 SimpleTest.waitForExplicitFinish();
michael@0 107 addA11yLoadEvent(doTest);
michael@0 108 </script>
michael@0 109 </head>
michael@0 110 <body>
michael@0 111 <div id="root">
michael@0 112 <a target="_blank"
michael@0 113 href="https://bugzilla.mozilla.org/show_bug.cgi?id=845870"
michael@0 114 title="[AccessFu] Trust explicitly associated names when speaking certain elements">
michael@0 115 Mozilla Bug 845870
michael@0 116 </a>
michael@0 117 <p id="display"></p>
michael@0 118 <div id="content" style="display: none"></div>
michael@0 119 <pre id="test"></pre>
michael@0 120 <button id="button1" aria-label="Press me">This is not a name</button>
michael@0 121 <button id="button2">
michael@0 122 Press me
michael@0 123 </button>
michael@0 124 <a id="anchor1" href="#test" title="title"></a>
michael@0 125 <a id="anchor2" href="#test">This is a link</a>
michael@0 126 <textarea id="textarea1" title="Test Text Area" cols="80" rows="5">This is the text area text.</textarea>
michael@0 127 <textarea id="textarea2" cols="80" rows="5">
michael@0 128 This is the text area text.
michael@0 129 </textarea>
michael@0 130 <h1 id="heading1" title="Test heading">This is the heading.</h1>
michael@0 131 <h1 id="heading2">
michael@0 132 This is the heading.
michael@0 133 </h1>
michael@0 134 <ol id="list" title="Test List">
michael@0 135 <li id="li_one" aria-label="Top of the list">list one</li>
michael@0 136 <li id="li_two">list two</li>
michael@0 137 </ol>
michael@0 138 <dl id="dlist" title="Test Definition List">
michael@0 139 <dd id="dd_one">dd one</dd>
michael@0 140 </dl>
michael@0 141 <table>
michael@0 142 <caption>Fruits and vegetables</caption>
michael@0 143 <tr>
michael@0 144 <td id="cell" aria-label="List of Fruits">
michael@0 145 <ul style="list-style-type: none;">
michael@0 146 <li><a id="apples" href="#">Apples</a></li>
michael@0 147 <li><a id="bananas" href="#">Bananas</a></li>
michael@0 148 <li><a href="#">Peaches</a></li>
michael@0 149 <li>
michael@0 150 <a href="#">
michael@0 151
michael@0 152 Plums
michael@0 153 </a>
michael@0 154 </li>
michael@0 155 </ul>
michael@0 156 </td>
michael@0 157 </tr>
michael@0 158 </table>
michael@0 159 <!-- app.net -->
michael@0 160 <ul id="app.net" class="unstyled ul-horizontal yui3-u fixed-right ta-right" style="list-style-type: none;">
michael@0 161 <li class="yui3-u">
michael@0 162 <a href="#star" data-starred="0" data-star-button="1" data-post-id="5098826" aria-label="star">
michael@0 163 Garbage
michael@0 164 </a>
michael@0 165 </li>
michael@0 166 <li class="yui3-u repost">
michael@0 167 <a href="#repost" title="repost" data-repost-button="1" data-reposted="0" data-post-id="5098826">
michael@0 168 <i aria-label="repost" class="icon-repost"></i>
michael@0 169 </a>
michael@0 170 </li>
michael@0 171 </ul>
michael@0 172 </div>
michael@0 173 </body>
michael@0 174 </html>

mercurial