accessible/tests/mochitest/jsat/test_explicit_names.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/jsat/test_explicit_names.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,174 @@
     1.4 +<html>
     1.5 +<head>
     1.6 +  <title>[AccessFu] Trust explicitly associated names when speaking certain elements</title>
     1.7 +
     1.8 +  <link rel="stylesheet" type="text/css"
     1.9 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.10 +  <script type="application/javascript"
    1.11 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/javascript"
    1.13 +          src="../common.js"></script>
    1.14 +  <script type="application/javascript"
    1.15 +          src="output.js"></script>
    1.16 +  <script type="application/javascript">
    1.17 +
    1.18 +    function doTest() {
    1.19 +      // Test the following accOrElmOrID.
    1.20 +      var tests = [{
    1.21 +        accOrElmOrID: "anchor1",
    1.22 +        expected: ["link", "title"]
    1.23 +      }, {
    1.24 +        accOrElmOrID: "anchor2",
    1.25 +        expected: ["link", "This is a link"]
    1.26 +      }, {
    1.27 +        accOrElmOrID: "button1",
    1.28 +        expected: ["button", "Press me"]
    1.29 +      }, {
    1.30 +        accOrElmOrID: "button2",
    1.31 +        expected: ["button", "Press me"]
    1.32 +      }, {
    1.33 +        accOrElmOrID: "textarea1",
    1.34 +        expected: ["text area", "This is the text area text.", "Test Text Area"]
    1.35 +      }, {
    1.36 +        accOrElmOrID: "textarea2",
    1.37 +        expected: ["text area", "This is the text area text."]
    1.38 +      }, {
    1.39 +        accOrElmOrID: "heading1",
    1.40 +        expected: ["heading level 1", "Test heading", "This is the heading."]
    1.41 +      }, {
    1.42 +        accOrElmOrID: "heading1",
    1.43 +        oldAccOrElmOrID: null,
    1.44 +        expected: [null /* parent doc title */, document.title,
    1.45 +		   "heading level 1", "Test heading", "This is the heading."]
    1.46 +      }, {
    1.47 +        accOrElmOrID: "heading2",
    1.48 +        expected: ["heading level 1", "This is the heading."]
    1.49 +      }, {
    1.50 +        accOrElmOrID: "list",
    1.51 +        expected: ["list 2 items", "Test List", "First item", "Top of the list",
    1.52 +          "Last item", "2.", "list two"]
    1.53 +      }, {
    1.54 +        accOrElmOrID: "dlist",
    1.55 +        expected: ["definition list 0.5 items", "Test Definition List",
    1.56 +          "dd one"]
    1.57 +      }, {
    1.58 +        accOrElmOrID: "li_one",
    1.59 +        expected: ["list 2 items", "Test List", "First item", "Top of the list"]
    1.60 +      }, {
    1.61 +        accOrElmOrID: "li_two",
    1.62 +        expected: ["list 2 items", "Test List", "Last item", "2.", "list two"]
    1.63 +      }, {
    1.64 +        accOrElmOrID: "cell",
    1.65 +        expected: ["table with 1 column and 1 row", "Fruits and vegetables",
    1.66 +          "Column 1 Row 1", "List of Fruits", "list 4 items", "First item",
    1.67 +          "link", "Apples", "link", "Bananas", "link", "Peaches", "Last item",
    1.68 +          "link", "Plums"]
    1.69 +      }, {
    1.70 +        accOrElmOrID: "app.net",
    1.71 +        expected: ["list 2 items", "First item", "link", "star", "Last item",
    1.72 +          "link", "repost"]
    1.73 +      }, {
    1.74 +        // Test pivot to list from li_one.
    1.75 +        accOrElmOrID: "list",
    1.76 +        oldAccOrElmOrID: "li_one",
    1.77 +        expected: ["list 2 items", "Test List", "First item", "Top of the list",
    1.78 +          "Last item", "2.", "list two"]
    1.79 +      }, {
    1.80 +        // Test pivot to li_one from list.
    1.81 +        accOrElmOrID: "li_one",
    1.82 +        oldAccOrElmOrID: "list",
    1.83 +        expected: ["First item", "Top of the list"]
    1.84 +      }, {
    1.85 +        // Test pivot to "apples" link from the table cell.
    1.86 +        accOrElmOrID: "apples",
    1.87 +        oldAccOrElmOrID: "cell",
    1.88 +        expected: ["list 4 items", "First item", "link", "Apples"]
    1.89 +      }, {
    1.90 +        // Test pivot to the table cell from the "apples" link.
    1.91 +        accOrElmOrID: "cell",
    1.92 +        oldAccOrElmOrID: "apples",
    1.93 +        expected: ["List of Fruits", "list 4 items", "First item", "link",
    1.94 +          "Apples", "link", "Bananas", "link", "Peaches", "Last item", "link",
    1.95 +          "Plums"]
    1.96 +      }];
    1.97 +
    1.98 +      SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, 0);
    1.99 +
   1.100 +      // Test various explicit names vs the utterance generated from subtrees.
   1.101 +      tests.forEach(function run(test) {
   1.102 +        testOutput(test.expected, test.accOrElmOrID, test.oldAccOrElmOrID, 1);
   1.103 +      });
   1.104 +
   1.105 +      SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
   1.106 +      SimpleTest.finish();
   1.107 +    }
   1.108 +
   1.109 +    SimpleTest.waitForExplicitFinish();
   1.110 +    addA11yLoadEvent(doTest);
   1.111 +  </script>
   1.112 +</head>
   1.113 +<body>
   1.114 +  <div id="root">
   1.115 +    <a target="_blank"
   1.116 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=845870"
   1.117 +       title="[AccessFu] Trust explicitly associated names when speaking certain elements">
   1.118 +       Mozilla Bug 845870
   1.119 +       </a>
   1.120 +    <p id="display"></p>
   1.121 +    <div id="content" style="display: none"></div>
   1.122 +    <pre id="test"></pre>
   1.123 +    <button id="button1" aria-label="Press me">This is not a name</button>
   1.124 +    <button id="button2">
   1.125 +      Press me
   1.126 +    </button>
   1.127 +    <a id="anchor1" href="#test" title="title"></a>
   1.128 +    <a id="anchor2" href="#test">This is a link</a>
   1.129 +    <textarea id="textarea1" title="Test Text Area" cols="80" rows="5">This is the text area text.</textarea>
   1.130 +    <textarea id="textarea2" cols="80" rows="5">
   1.131 +      This is the text area text.
   1.132 +    </textarea>
   1.133 +    <h1 id="heading1" title="Test heading">This is the heading.</h1>
   1.134 +    <h1 id="heading2">
   1.135 +      This is the heading.
   1.136 +    </h1>
   1.137 +    <ol id="list" title="Test List">
   1.138 +      <li id="li_one" aria-label="Top of the list">list one</li>
   1.139 +      <li id="li_two">list two</li>
   1.140 +    </ol>
   1.141 +    <dl id="dlist" title="Test Definition List">
   1.142 +      <dd id="dd_one">dd one</dd>
   1.143 +    </dl>
   1.144 +    <table>
   1.145 +      <caption>Fruits and vegetables</caption>
   1.146 +      <tr>
   1.147 +        <td id="cell" aria-label="List of Fruits">
   1.148 +          <ul style="list-style-type: none;">
   1.149 +            <li><a id="apples" href="#">Apples</a></li>
   1.150 +            <li><a id="bananas" href="#">Bananas</a></li>
   1.151 +            <li><a href="#">Peaches</a></li>
   1.152 +            <li>
   1.153 +              <a href="#">
   1.154 +
   1.155 +                Plums
   1.156 +              </a>
   1.157 +            </li>
   1.158 +          </ul>
   1.159 +        </td>
   1.160 +      </tr>
   1.161 +    </table>
   1.162 +    <!-- app.net -->
   1.163 +    <ul id="app.net" class="unstyled ul-horizontal yui3-u fixed-right ta-right" style="list-style-type: none;">
   1.164 +      <li class="yui3-u">
   1.165 +        <a href="#star" data-starred="0" data-star-button="1" data-post-id="5098826" aria-label="star">
   1.166 +          Garbage
   1.167 +        </a>
   1.168 +      </li>
   1.169 +      <li class="yui3-u repost">
   1.170 +        <a href="#repost" title="repost" data-repost-button="1" data-reposted="0" data-post-id="5098826">
   1.171 +          <i aria-label="repost" class="icon-repost"></i>
   1.172 +        </a>
   1.173 +      </li>
   1.174 +    </ul>
   1.175 +  </div>
   1.176 +</body>
   1.177 +</html>

mercurial