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.

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

mercurial