1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/jsat/test_output.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,459 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=753984 1.8 +--> 1.9 + <head> 1.10 + <title>[AccessFu] utterance order test</title> 1.11 + <meta charset="utf-8"> 1.12 + <link rel="stylesheet" type="text/css" 1.13 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.16 + <script type="application/javascript" 1.17 + src="../common.js"></script> 1.18 + <script type="application/javascript" 1.19 + src="./output.js"></script> 1.20 + <script type="application/javascript"> 1.21 + 1.22 + function doTest() { 1.23 + // Test the following accOrElmOrID (with optional old accOrElmOrID). 1.24 + // Note: each accOrElmOrID entry maps to a unique object utterance 1.25 + // generator function within the UtteranceGenerator. 1.26 + var tests = [{ 1.27 + accOrElmOrID: "anchor", 1.28 + expectedUtterance: [["link", "title"], ["title", "link"]], 1.29 + expectedBraille: [["lnk", "title"], ["title", "lnk"]] 1.30 + }, { 1.31 + accOrElmOrID: "anchor_titleandtext", 1.32 + expectedUtterance: [["link", "goes to the tests -", "Tests"], 1.33 + ["Tests", "- goes to the tests", "link"]], 1.34 + expectedBraille: [["lnk", "goes to the tests -", "Tests"], 1.35 + ["Tests", "- goes to the tests", "lnk"]], 1.36 + }, { 1.37 + accOrElmOrID: "anchor_duplicatedtitleandtext", 1.38 + expectedUtterance: [["link", "Tests"], ["Tests", "link"]], 1.39 + expectedBraille: [["lnk", "Tests"], ["Tests", "lnk"]] 1.40 + }, { 1.41 + accOrElmOrID: "anchor_arialabelandtext", 1.42 + expectedUtterance: [["link", "goes to the tests - Tests"], 1.43 + ["Tests - goes to the tests", "link"]], 1.44 + expectedBraille: [["lnk", "goes to the tests - Tests"], 1.45 + ["Tests - goes to the tests", "lnk"]], 1.46 + }, { 1.47 + accOrElmOrID: "textarea", 1.48 + expectedUtterance: [[ 1.49 + "text area", "This is the text area text." 1.50 + ], [ 1.51 + "This is the text area text.", "text area" 1.52 + ],], 1.53 + expectedBraille: [[ 1.54 + "txtarea", "This is the text area text." 1.55 + ], [ 1.56 + "This is the text area text.", "txtarea" 1.57 + ],], 1.58 + }, { 1.59 + accOrElmOrID: "heading", 1.60 + expectedUtterance: [ 1.61 + ["heading level 1", "Test heading"], 1.62 + ["Test heading", "heading level 1"] 1.63 + ], 1.64 + expectedBraille: [ 1.65 + ["heading", "Test heading"], 1.66 + ["Test heading", "heading"] 1.67 + ] 1.68 + }, { 1.69 + accOrElmOrID: "list", 1.70 + expectedUtterance: [ 1.71 + ["list 1 item", "First item", "1.", "list one"], 1.72 + ["1.", "list one", "First item", "list 1 item"] 1.73 + ], 1.74 + expectedBraille: [ 1.75 + ["list", "list one"], 1.76 + ["list one", "list"] 1.77 + ] 1.78 + }, { 1.79 + accOrElmOrID: "dlist", 1.80 + expectedUtterance: [ 1.81 + ["definition list 0.5 items", "dd one"], 1.82 + ["dd one", "definition list 0.5 items"] 1.83 + ], 1.84 + expectedBraille: [ 1.85 + ["definition list", "dd one"], 1.86 + ["dd one", "definition list"] 1.87 + ] 1.88 + }, { 1.89 + accOrElmOrID: "li_one", 1.90 + expectedUtterance: [ 1.91 + ["list 1 item", "First item", "1.", "list one"], 1.92 + ["1.", "list one", "First item", "list 1 item"] 1.93 + ], 1.94 + expectedBraille: [ 1.95 + ["1.", "list one"], 1.96 + ["1.", "list one"] 1.97 + ] 1.98 + }, { 1.99 + accOrElmOrID: "cell", 1.100 + expectedUtterance: [[ 1.101 + "table with 1 column and 1 row", "Fruits and vegetables", 1.102 + "Column 1 Row 1", "list 4 items", "First item", "link", "Apples", 1.103 + "link", "Bananas", "link", "Peaches", "Last item", "link", "Plums" 1.104 + ], [ 1.105 + "Apples", "link", "First item", "Bananas", "link", "Peaches", 1.106 + "link", "Plums", "link", "Last item", "list 4 items", 1.107 + "Column 1 Row 1", "Fruits and vegetables", 1.108 + "table with 1 column and 1 row" 1.109 + ]], 1.110 + expectedBraille: [[ 1.111 + "c1r1", "list", "lnk", "Apples", "lnk", "Bananas", "lnk", 1.112 + "Peaches", "lnk", "Plums" 1.113 + ], [ 1.114 + "Apples", "lnk", "Bananas", "lnk", "Peaches", "lnk", "Plums", 1.115 + "lnk", "list", "c1r1" 1.116 + ]] 1.117 + }, { 1.118 + accOrElmOrID: "date", 1.119 + expectedUtterance: [["date entry", "2011-09-29"], ["2011-09-29", "date entry"]], 1.120 + expectedBraille: [["date entry", "2011-09-29"], ["2011-09-29", "date entry"]] 1.121 + }, { 1.122 + accOrElmOrID: "email", 1.123 + expectedUtterance: [ 1.124 + ["e-mail entry", "test@example.com"], 1.125 + ["test@example.com", "e-mail entry"] 1.126 + ], 1.127 + expectedBraille: [ 1.128 + ["e-mail entry", "test@example.com"], 1.129 + ["test@example.com", "e-mail entry"] 1.130 + ] 1.131 + }, { 1.132 + accOrElmOrID: "search", 1.133 + expectedUtterance: [ 1.134 + ["search entry", "This is a search"], 1.135 + ["This is a search", "search entry"] 1.136 + ], 1.137 + expectedBraille: [ 1.138 + ["search entry", "This is a search"], 1.139 + ["This is a search", "search entry"] 1.140 + ] 1.141 + }, { 1.142 + accOrElmOrID: "tel", 1.143 + expectedUtterance: [ 1.144 + ["telephone entry", "555-5555"], ["555-5555", "telephone entry"] 1.145 + ], 1.146 + expectedBraille: [ 1.147 + ["telephone entry", "555-5555"], ["555-5555", "telephone entry"] 1.148 + ] 1.149 + }, { 1.150 + accOrElmOrID: "url", 1.151 + expectedUtterance: [ 1.152 + ["URL entry", "http://example.com"], 1.153 + ["http://example.com", "URL entry"] 1.154 + ], 1.155 + expectedBraille: [ 1.156 + ["URL entry", "http://example.com"], 1.157 + ["http://example.com", "URL entry"] 1.158 + ] 1.159 + }, { 1.160 + accOrElmOrID: "textInput", 1.161 + expectedUtterance: [["entry", "This is text."], ["This is text.", "entry"]], 1.162 + expectedBraille: [["entry", "This is text."], ["This is text.", "entry"]] 1.163 + }, { 1.164 + // Test pivot to list from li_one. 1.165 + accOrElmOrID: "list", 1.166 + oldAccOrElmOrID: "li_one", 1.167 + expectedUtterance: [ 1.168 + ["list 1 item", "First item", "1.", "list one"], 1.169 + ["1.", "list one", "First item", "list 1 item"] 1.170 + ], 1.171 + expectedBraille: [ 1.172 + ["list", "list one"], 1.173 + ["list one", "list"] 1.174 + ] 1.175 + }, { 1.176 + // Test pivot to "apples" link from the table cell. 1.177 + accOrElmOrID: "apples", 1.178 + oldAccOrElmOrID: "cell", 1.179 + expectedUtterance: [ 1.180 + ["list 4 items", "First item", "link", "Apples"], 1.181 + ["Apples", "link", "First item", "list 4 items"] 1.182 + ], 1.183 + expectedBraille: [ 1.184 + ["*", "lnk", "Apples"], 1.185 + ["*", "Apples", "lnk"] 1.186 + ] 1.187 + }, { 1.188 + // Test pivot to 'bananas' link from 'apples' link. 1.189 + accOrElmOrID: "bananas", 1.190 + oldAccOrElmOrID: "apples", 1.191 + expectedUtterance: [["link", "Bananas"], ["Bananas", "link"]], 1.192 + expectedBraille: [["*", "lnk", "Bananas"], ["*", "Bananas", "lnk"]] 1.193 + }, { 1.194 + // test unavailable state utterance 1.195 + accOrElmOrID: 'unavailableButton', 1.196 + expectedUtterance: [["unavailable button", "I am unavailable"], 1.197 + ["I am unavailable", "unavailable button"]], 1.198 + expectedBraille: [["btn", "I am unavailable"], 1.199 + ["I am unavailable", "btn"]] 1.200 + }, { 1.201 + // test expanded state utterance 1.202 + accOrElmOrID: 'expandedButton', 1.203 + expectedUtterance: [["expanded button", "I am expanded"], 1.204 + ["I am expanded", "expanded button"]], 1.205 + expectedBraille: [["btn", "I am expanded"], 1.206 + ["I am expanded", "btn"]] 1.207 + }, { 1.208 + // test collapsed state utterance 1.209 + accOrElmOrID: 'collapsedButton', 1.210 + expectedUtterance: [["collapsed button", "I am collapsed"], 1.211 + ["I am collapsed", "collapsed button"]], 1.212 + expectedBraille: [["btn", "I am collapsed"], 1.213 + ["I am collapsed", "btn"]] 1.214 + }, { 1.215 + // test required state utterance 1.216 + accOrElmOrID: 'requiredInput', 1.217 + expectedUtterance: [["required entry", "I am required"], 1.218 + ["I am required", "required entry"]], 1.219 + expectedBraille: [["entry", "I am required"], 1.220 + ["I am required", "entry"]] 1.221 + }, { 1.222 + // test has popup state utterance 1.223 + accOrElmOrID: 'hasPopupButton', 1.224 + expectedUtterance: [["has pop up button menu", "I have a popup"], 1.225 + ["I have a popup", "has pop up button menu"]], 1.226 + expectedBraille: [["button menu", "I have a popup"], 1.227 + ["I have a popup", "button menu"]] 1.228 + }, { 1.229 + // Test selected tab 1.230 + accOrElmOrID: 'tab1', 1.231 + expectedUtterance: [['tab list', 'selected tab 1 of 2', 'Account'], 1.232 + ['Account', 'selected tab 1 of 2', 'tab list']], 1.233 + expectedBraille: [['tab 1 of 2', 'Account'], 1.234 + ['Account', 'tab 1 of 2']] 1.235 + }, { 1.236 + // Test unselected tab 1.237 + accOrElmOrID: 'tab2', 1.238 + expectedUtterance: [['tab list', 'tab 2 of 2', 'Advanced'], 1.239 + ['Advanced', 'tab 2 of 2', 'tab list']], 1.240 + expectedBraille: [['tab 2 of 2', 'Advanced'], 1.241 + ['Advanced', 'tab 2 of 2']] 1.242 + }, 1.243 + 1.244 + { 1.245 + // Landing on this label should mimic landing on the checkbox. 1.246 + accOrElmOrID: "label1", 1.247 + expectedUtterance: [['not checked check button', 'Orange'], 1.248 + ['Orange', 'not checked check button']], 1.249 + expectedBraille: [['( )', 'Orange'], 1.250 + ['Orange', '( )']] 1.251 + }, 1.252 + { 1.253 + // Here we get a top-level view of the form. 1.254 + accOrElmOrID: "form1", 1.255 + expectedUtterance: [['label', 'not checked check button', 'Orange', 'Orange', 1.256 + 'not checked check button', 'Blue', 'label', 'Blue'], 1.257 + ['Orange', 'not checked check button', 'Orange', 'label', 1.258 + 'Blue', 'not checked check button', 'Blue', 'label']], 1.259 + expectedBraille: [['label', '( )', 'Orange', 'Orange', 1.260 + '( )', 'Blue', 'label', 'Blue'], 1.261 + ['Orange', '( )', 'Orange', 'label', 1.262 + 'Blue', '( )', 'Blue', 'label']] 1.263 + }, 1.264 + { 1.265 + // This is a non-nesting label. 1.266 + accOrElmOrID: "label2", 1.267 + expectedUtterance: [['label', 'Blue'], ['Blue', 'label']], 1.268 + expectedBraille: [['label', 'Blue'], ['Blue', 'label']] 1.269 + }, 1.270 + { 1.271 + // This is a distinct control. 1.272 + accOrElmOrID: "input2", 1.273 + expectedUtterance: [['not checked check button', 'Blue'], 1.274 + ['Blue', 'not checked check button']], 1.275 + expectedBraille: [['( )', 'Blue'], 1.276 + ['Blue', '( )']] 1.277 + }, 1.278 + { 1.279 + // This is a nested control. 1.280 + accOrElmOrID: "input1", 1.281 + expectedUtterance: [['not checked check button', 'Orange'], 1.282 + ['Orange', 'not checked check button']], 1.283 + expectedBraille: [['( )', 'Orange'], 1.284 + ['Orange', '( )']] 1.285 + }, 1.286 + { 1.287 + // Landing on this label should mimic landing on the entry. 1.288 + accOrElmOrID: "label3", 1.289 + expectedUtterance: [['entry', 'Joe', 'First name:'], 1.290 + ['First name:', 'Joe', 'entry']], 1.291 + expectedBraille: [['entry', 'Joe', 'First name:'], 1.292 + ['First name:', 'Joe', 'entry']] 1.293 + }, 1.294 + { 1.295 + // This is a nested control with a value. 1.296 + accOrElmOrID: "input3", 1.297 + expectedUtterance: [['entry', 'Joe', 'First name:'], 1.298 + ['First name:', 'Joe', 'entry']], 1.299 + expectedBraille: [['entry', 'Joe', 'First name:'], 1.300 + ['First name:', 'Joe', 'entry']] 1.301 + }, 1.302 + { 1.303 + // This is a nested control with a value. 1.304 + accOrElmOrID: "input4", 1.305 + expectedUtterance: [['slider', '3', 'Points:'], 1.306 + ['Points:', '3', 'slider']], 1.307 + expectedBraille: [['slider', '3', 'Points:'], 1.308 + ['Points:', '3', 'slider']] 1.309 + },{ 1.310 + accOrElmOrID: "password", 1.311 + expectedUtterance: [["password text", "Secret Password"], 1.312 + ["Secret Password", "password text"]], 1.313 + expectedBraille: [["passwdtxt", "Secret Password"], 1.314 + ["Secret Password", "passwdtxt"]] 1.315 + },{ 1.316 + accOrElmOrID: "input5", 1.317 + expectedUtterance: [["checked check button", "Boring label"], 1.318 + ["Boring label", "checked check button"]], 1.319 + expectedBraille: [["(x)", "Boring label"], 1.320 + ["Boring label", "(x)"]] 1.321 + },{ 1.322 + accOrElmOrID: "radio_unselected", 1.323 + expectedUtterance: [["not checked radio button", "any old radio button"], 1.324 + ["any old radio button", "not checked radio button"]], 1.325 + expectedBraille: [["( )", "any old radio button"], 1.326 + ["any old radio button", "( )"]] 1.327 + },{ 1.328 + accOrElmOrID: "radio_selected", 1.329 + expectedUtterance: [["checked radio button", "a unique radio button"], 1.330 + ["a unique radio button", "checked radio button"]], 1.331 + expectedBraille: [["(x)", "a unique radio button"], 1.332 + ["a unique radio button", "(x)"]] 1.333 + },{ 1.334 + accOrElmOrID: "togglebutton_notpressed", 1.335 + expectedUtterance: [["toggle button", "I ain't pressed"], 1.336 + ["I ain't pressed", "toggle button"]], 1.337 + expectedBraille: [["( )", "I ain't pressed"], 1.338 + ["I ain't pressed", "( )"]] 1.339 + },{ 1.340 + accOrElmOrID: "togglebutton_pressed", 1.341 + expectedUtterance: [["pressed toggle button", "I am pressed!"], 1.342 + ["I am pressed!", "pressed toggle button"]], 1.343 + expectedBraille: [["(x)", "I am pressed!"], 1.344 + ["I am pressed!", "(x)"]] 1.345 + } 1.346 + ]; 1.347 + 1.348 + // Test all possible utterance order preference values. 1.349 + tests.forEach(function run(test) { 1.350 + var utteranceOrderValues = [0, 1]; 1.351 + utteranceOrderValues.forEach( 1.352 + function testUtteranceOrder(utteranceOrder) { 1.353 + SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, utteranceOrder); 1.354 + testOutput(test.expectedUtterance[utteranceOrder], 1.355 + test.accOrElmOrID, test.oldAccOrElmOrID, 1); 1.356 + testOutput(test.expectedBraille[utteranceOrder], 1.357 + test.accOrElmOrID, test.oldAccOrElmOrID, 0); 1.358 + } 1.359 + ); 1.360 + }); 1.361 + 1.362 + // If there was an original utterance order preference, revert to it. 1.363 + SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER); 1.364 + SimpleTest.finish(); 1.365 + } 1.366 + 1.367 + SimpleTest.waitForExplicitFinish(); 1.368 + addA11yLoadEvent(doTest); 1.369 + 1.370 + </script> 1.371 + </head> 1.372 + <body> 1.373 + <div id="root"> 1.374 + <a target="_blank" 1.375 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=753984" 1.376 + title="[AccessFu] utterance order test"> 1.377 + Mozilla Bug 753984</a> 1.378 + <a target="_blank" 1.379 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=758675" 1.380 + title="[AccessFu] Add support for accDescription"> 1.381 + Mozilla Bug 758675</a> 1.382 + <a target="_blank" 1.383 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=876475" 1.384 + title="[AccessFu] Make braille output less verbose"> 1.385 + Mozilla Bug 876475</a> 1.386 + <a target="_blank" 1.387 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=924284" 1.388 + title="[AccessFu] Output accessible values"> 1.389 + Mozilla Bug 924284</a> 1.390 + <a target="_blank" 1.391 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=925845" 1.392 + title="[AccessFu] Unify output tests"> 1.393 + Mozilla Bug 925845</a> 1.394 + <p id="display"></p> 1.395 + <div id="content" style="display: none"></div> 1.396 + <pre id="test"></pre> 1.397 + <a id="anchor" href="#test" title="title"></a> 1.398 + <a id="anchor_titleandtext" href="#test" title="goes to the tests">Tests</a> 1.399 + <a id="anchor_duplicatedtitleandtext" href="#test" title="Tests">Tests</a> 1.400 + <a id="anchor_arialabelandtext" href="#test" aria-label="Tests" title="goes to the tests">Tests</a> 1.401 + <textarea id="textarea" cols="80" rows="5"> 1.402 + This is the text area text. 1.403 + </textarea> 1.404 + <h1 id="heading" title="Test heading"></h1> 1.405 + <ol id="list"> 1.406 + <li id="li_one">list one</li> 1.407 + </ol> 1.408 + <dl id="dlist"> 1.409 + <dd id="dd_one"> 1.410 + dd one 1.411 + </dd> 1.412 + </dl> 1.413 + <table> 1.414 + <caption>Fruits and vegetables</caption> 1.415 + <tr> 1.416 + <td id="cell"> 1.417 + <ul style="list-style-type: none;"> 1.418 + <li><a id="apples" href="#">Apples</a></li> 1.419 + <li><a id="bananas" href="#">Bananas</a></li> 1.420 + <li><a href="#">Peaches</a></li> 1.421 + <li> 1.422 + <a href="#"> 1.423 + Plums 1.424 + </a> 1.425 + </li> 1.426 + </ul> 1.427 + </td> 1.428 + </tr> 1.429 + </table> 1.430 + <button id="unavailableButton" disabled>I am unavailable</button> 1.431 + <button id="expandedButton" aria-expanded="true">I am expanded</button> 1.432 + <button id="collapsedButton" aria-expanded="false">I am collapsed</button> 1.433 + <input id="requiredInput" required placeholder="I am required" /> 1.434 + <button id="hasPopupButton" aria-haspopup="true">I have a popup</button> 1.435 + <div role="tablist"> 1.436 + <a id="tab1" href="#" role="tab" aria-selected="true">Account</a> 1.437 + <a id="tab2" href="#" role="tab" aria-selected="false">Advanced</a> 1.438 + </div> 1.439 + <form id="form1"> 1.440 + <label id="label1"><input id="input1" type="checkbox">Orange</label> 1.441 + <input id="input2" type="checkbox"><label id="label2" for="input2">Blue</label> 1.442 + </form> 1.443 + <label id="label3">First name: <input id="input3" value="Joe"></label> 1.444 + <label id="label4">Points: 1.445 + <input id="input4" type="range" name="points" min="1" max="10" value="3"> 1.446 + </label> 1.447 + <label for="input5">Boring label</label><input id="input5" type="checkbox" checked></input> 1.448 + <label for="password">Secret Password</label><input id="password" type="password"></input> 1.449 + <label for="radio_unselected">any old radio button</label><input id="radio_unselected" type="radio"></input> 1.450 + <label for="radio_selected">a unique radio button</label><input id="radio_selected" type="radio" checked></input> 1.451 + <input id="date" type="date" value="2011-09-29" /> 1.452 + <input id="email" type="email" value="test@example.com" /> 1.453 + <input id="search" type="search" value="This is a search" /> 1.454 + <input id="tel" type="tel" value="555-5555" /> 1.455 + <input id="url" type="url" value="http://example.com" /> 1.456 + <input id="textInput" type="text" value="This is text." /> 1.457 + <label>Points: <input id="range" type="range" name="points" min="1" max="10" value="3"></label> 1.458 + <div id="togglebutton_notpressed" aria-pressed="false" role="button" tabindex="-1">I ain't pressed</div> 1.459 + <div id="togglebutton_pressed" aria-pressed="true" role="button" tabindex="-1">I am pressed!</div> 1.460 + </div> 1.461 + </body> 1.462 +</html>