accessible/tests/mochitest/jsat/test_landmarks.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/jsat/test_landmarks.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,152 @@
     1.4 +<html>
     1.5 +<head>
     1.6 +  <title> [AccessFu] Speak landmarks</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: "nav",
    1.22 +        expectedUtterance: [["navigation", "a nav"], ["a nav", "navigation"]],
    1.23 +        expectedBraille: [["navigation", "a nav"], ["a nav", "navigation"]]
    1.24 +      }, {
    1.25 +        accOrElmOrID: "main",
    1.26 +        expectedUtterance: [["main", "a main area"], ["a main area", "main"]],
    1.27 +        expectedBraille: [["main", "a main area"], ["a main area", "main"]]
    1.28 +      }, {
    1.29 +        accOrElmOrID: "header",
    1.30 +        expectedUtterance: [["banner", "header", "a header"], ["a header",
    1.31 +          "header", "banner"]],
    1.32 +        expectedBraille: [["banner", "header", "a header"], ["a header",
    1.33 +          "header", "banner"]]
    1.34 +      }, {
    1.35 +        accOrElmOrID: "footer",
    1.36 +        expectedUtterance: [["content info", "footer", "a footer"], [
    1.37 +          "a footer", "footer", "content info"]],
    1.38 +        expectedBraille: [["content info", "footer", "a footer"], ["a footer",
    1.39 +          "footer", "content info"]]
    1.40 +      }, {
    1.41 +        accOrElmOrID: "article_header",
    1.42 +        expectedUtterance: [["header", "a header within an article"], [
    1.43 +          "a header within an article", "header"]],
    1.44 +        expectedBraille: [["header", "a header within an article"], [
    1.45 +          "a header within an article", "header"]],
    1.46 +      }, {
    1.47 +        accOrElmOrID: "article_footer",
    1.48 +        expectedUtterance: [["footer", "a footer within an article"], [
    1.49 +          "a footer within an article", "footer"]],
    1.50 +        expectedBraille: [["footer", "a footer within an article"], [
    1.51 +          "a footer within an article", "footer"]]
    1.52 +      }, {
    1.53 +        accOrElmOrID: "section_header",
    1.54 +        expectedUtterance: [["header", "a header within a section"], [
    1.55 +          "a header within a section", "header"]],
    1.56 +        expectedBraille: [["header", "a header within a section"], [
    1.57 +          "a header within a section", "header"]]
    1.58 +      }, {
    1.59 +        accOrElmOrID: "section_footer",
    1.60 +        expectedUtterance: [["footer", "a footer within a section"], [
    1.61 +          "a footer within a section", "footer"]],
    1.62 +        expectedBraille: [["footer", "a footer within a section"], [
    1.63 +          "a footer within a section", "footer"]]
    1.64 +      }, {
    1.65 +        accOrElmOrID: "aside",
    1.66 +        expectedUtterance: [["complementary", "by the way I am an aside"], [
    1.67 +          "by the way I am an aside", "complementary"]],
    1.68 +        expectedBraille: [["complementary", "by the way I am an aside"], [
    1.69 +          "by the way I am an aside", "complementary"]]
    1.70 +      }, {
    1.71 +        accOrElmOrID: "main_element",
    1.72 +        expectedUtterance: [["main", "another main area"], [
    1.73 +          "another main area", "main"]],
    1.74 +        expectedBraille: [["main", "another main area"], ["another main area",
    1.75 +          "main"]]
    1.76 +      }, {
    1.77 +        accOrElmOrID: "complementary",
    1.78 +        expectedUtterance: [["list 1 item", "complementary", "First item",
    1.79 +          "A complementary"], ["A complementary", "First item",
    1.80 +          "complementary", "list 1 item"]],
    1.81 +        expectedBraille: [["*", "complementary", "A complementary"], ["*",
    1.82 +          "A complementary", "complementary"]]
    1.83 +      }, {
    1.84 +        accOrElmOrID: "parent_main",
    1.85 +        expectedUtterance: [["main", "a parent main", "complementary",
    1.86 +          "a child complementary"], ["a parent main", "a child complementary",
    1.87 +          "complementary", "main"]],
    1.88 +        expectedBraille: [["main", "a parent main", "complementary",
    1.89 +          "a child complementary"], ["a parent main", "a child complementary",
    1.90 +          "complementary", "main"]]
    1.91 +      }, {
    1.92 +        accOrElmOrID: "child_complementary",
    1.93 +        expectedUtterance: [["main", "complementary", "a child complementary"],
    1.94 +          ["a child complementary", "complementary", "main"]],
    1.95 +        expectedBraille: [["complementary", "a child complementary"],
    1.96 +          ["a child complementary", "complementary"]]
    1.97 +      }];
    1.98 +
    1.99 +      // Test outputs (utterance and braille) for landmarks.
   1.100 +      tests.forEach(function run(test) {
   1.101 +        var outputOrderValues = [0, 1];
   1.102 +        outputOrderValues.forEach(function testOutputOrder(outputOrder) {
   1.103 +          SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, outputOrder);
   1.104 +          testOutput(test.expectedUtterance[outputOrder], test.accOrElmOrID,
   1.105 +            test.oldAccOrElmOrID, 1);
   1.106 +          testOutput(test.expectedBraille[outputOrder], test.accOrElmOrID,
   1.107 +            test.oldAccOrElmOrID, 0);
   1.108 +        });
   1.109 +      });
   1.110 +
   1.111 +      // If there was an original utterance order preference, revert to it.
   1.112 +      SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER);
   1.113 +      SimpleTest.finish();
   1.114 +    }
   1.115 +
   1.116 +    SimpleTest.waitForExplicitFinish();
   1.117 +    addA11yLoadEvent(doTest);
   1.118 +  </script>
   1.119 +</head>
   1.120 +<body>
   1.121 +  <div id="root">
   1.122 +    <a target="_blank"
   1.123 +       href="https://bugzilla.mozilla.org/show_bug.cgi?id=888256"
   1.124 +       title="[AccessFu] Speak landmarks">
   1.125 +       Mozilla Bug 888256
   1.126 +       </a>
   1.127 +    <p id="display"></p>
   1.128 +    <div id="content" style="display: none"></div>
   1.129 +    <pre id="test"></pre>
   1.130 +    <nav id="nav">a nav</nav>
   1.131 +    <header id="header">a header</header>
   1.132 +    <footer id="footer">a footer</footer>
   1.133 +    <article id="article_with_header_and_footer">
   1.134 +      <header id="article_header">a header within an article</header>
   1.135 +      <footer id="article_footer">a footer within an article</footer>
   1.136 +    </article>
   1.137 +    <section id="section_with_header_and_footer">
   1.138 +      <header id="section_header">a header within a section</header>
   1.139 +      <footer id="section_footer">a footer within a section</footer>
   1.140 +    </section>
   1.141 +    <aside id="aside">by the way I am an aside</aside>
   1.142 +    <article id="main" role="main">a main area</article>
   1.143 +    <main id="main_element">another main area</main>
   1.144 +    <ul style="list-style-type: none;">
   1.145 +      <li role="complementary" id="complementary">
   1.146 +        A complementary
   1.147 +      </li>
   1.148 +    </ul>
   1.149 +    <main id="parent_main">
   1.150 +      a parent main
   1.151 +      <p id="child_complementary" role="complementary">a child complementary</article>
   1.152 +    </main>
   1.153 +  </div>
   1.154 +</body>
   1.155 +</html>

mercurial