Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | <html> |
michael@0 | 2 | <head> |
michael@0 | 3 | <title> [AccessFu] Speak landmarks</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: "nav", |
michael@0 | 19 | expectedUtterance: [["navigation", "a nav"], ["a nav", "navigation"]], |
michael@0 | 20 | expectedBraille: [["navigation", "a nav"], ["a nav", "navigation"]] |
michael@0 | 21 | }, { |
michael@0 | 22 | accOrElmOrID: "main", |
michael@0 | 23 | expectedUtterance: [["main", "a main area"], ["a main area", "main"]], |
michael@0 | 24 | expectedBraille: [["main", "a main area"], ["a main area", "main"]] |
michael@0 | 25 | }, { |
michael@0 | 26 | accOrElmOrID: "header", |
michael@0 | 27 | expectedUtterance: [["banner", "header", "a header"], ["a header", |
michael@0 | 28 | "header", "banner"]], |
michael@0 | 29 | expectedBraille: [["banner", "header", "a header"], ["a header", |
michael@0 | 30 | "header", "banner"]] |
michael@0 | 31 | }, { |
michael@0 | 32 | accOrElmOrID: "footer", |
michael@0 | 33 | expectedUtterance: [["content info", "footer", "a footer"], [ |
michael@0 | 34 | "a footer", "footer", "content info"]], |
michael@0 | 35 | expectedBraille: [["content info", "footer", "a footer"], ["a footer", |
michael@0 | 36 | "footer", "content info"]] |
michael@0 | 37 | }, { |
michael@0 | 38 | accOrElmOrID: "article_header", |
michael@0 | 39 | expectedUtterance: [["header", "a header within an article"], [ |
michael@0 | 40 | "a header within an article", "header"]], |
michael@0 | 41 | expectedBraille: [["header", "a header within an article"], [ |
michael@0 | 42 | "a header within an article", "header"]], |
michael@0 | 43 | }, { |
michael@0 | 44 | accOrElmOrID: "article_footer", |
michael@0 | 45 | expectedUtterance: [["footer", "a footer within an article"], [ |
michael@0 | 46 | "a footer within an article", "footer"]], |
michael@0 | 47 | expectedBraille: [["footer", "a footer within an article"], [ |
michael@0 | 48 | "a footer within an article", "footer"]] |
michael@0 | 49 | }, { |
michael@0 | 50 | accOrElmOrID: "section_header", |
michael@0 | 51 | expectedUtterance: [["header", "a header within a section"], [ |
michael@0 | 52 | "a header within a section", "header"]], |
michael@0 | 53 | expectedBraille: [["header", "a header within a section"], [ |
michael@0 | 54 | "a header within a section", "header"]] |
michael@0 | 55 | }, { |
michael@0 | 56 | accOrElmOrID: "section_footer", |
michael@0 | 57 | expectedUtterance: [["footer", "a footer within a section"], [ |
michael@0 | 58 | "a footer within a section", "footer"]], |
michael@0 | 59 | expectedBraille: [["footer", "a footer within a section"], [ |
michael@0 | 60 | "a footer within a section", "footer"]] |
michael@0 | 61 | }, { |
michael@0 | 62 | accOrElmOrID: "aside", |
michael@0 | 63 | expectedUtterance: [["complementary", "by the way I am an aside"], [ |
michael@0 | 64 | "by the way I am an aside", "complementary"]], |
michael@0 | 65 | expectedBraille: [["complementary", "by the way I am an aside"], [ |
michael@0 | 66 | "by the way I am an aside", "complementary"]] |
michael@0 | 67 | }, { |
michael@0 | 68 | accOrElmOrID: "main_element", |
michael@0 | 69 | expectedUtterance: [["main", "another main area"], [ |
michael@0 | 70 | "another main area", "main"]], |
michael@0 | 71 | expectedBraille: [["main", "another main area"], ["another main area", |
michael@0 | 72 | "main"]] |
michael@0 | 73 | }, { |
michael@0 | 74 | accOrElmOrID: "complementary", |
michael@0 | 75 | expectedUtterance: [["list 1 item", "complementary", "First item", |
michael@0 | 76 | "A complementary"], ["A complementary", "First item", |
michael@0 | 77 | "complementary", "list 1 item"]], |
michael@0 | 78 | expectedBraille: [["*", "complementary", "A complementary"], ["*", |
michael@0 | 79 | "A complementary", "complementary"]] |
michael@0 | 80 | }, { |
michael@0 | 81 | accOrElmOrID: "parent_main", |
michael@0 | 82 | expectedUtterance: [["main", "a parent main", "complementary", |
michael@0 | 83 | "a child complementary"], ["a parent main", "a child complementary", |
michael@0 | 84 | "complementary", "main"]], |
michael@0 | 85 | expectedBraille: [["main", "a parent main", "complementary", |
michael@0 | 86 | "a child complementary"], ["a parent main", "a child complementary", |
michael@0 | 87 | "complementary", "main"]] |
michael@0 | 88 | }, { |
michael@0 | 89 | accOrElmOrID: "child_complementary", |
michael@0 | 90 | expectedUtterance: [["main", "complementary", "a child complementary"], |
michael@0 | 91 | ["a child complementary", "complementary", "main"]], |
michael@0 | 92 | expectedBraille: [["complementary", "a child complementary"], |
michael@0 | 93 | ["a child complementary", "complementary"]] |
michael@0 | 94 | }]; |
michael@0 | 95 | |
michael@0 | 96 | // Test outputs (utterance and braille) for landmarks. |
michael@0 | 97 | tests.forEach(function run(test) { |
michael@0 | 98 | var outputOrderValues = [0, 1]; |
michael@0 | 99 | outputOrderValues.forEach(function testOutputOrder(outputOrder) { |
michael@0 | 100 | SpecialPowers.setIntPref(PREF_UTTERANCE_ORDER, outputOrder); |
michael@0 | 101 | testOutput(test.expectedUtterance[outputOrder], test.accOrElmOrID, |
michael@0 | 102 | test.oldAccOrElmOrID, 1); |
michael@0 | 103 | testOutput(test.expectedBraille[outputOrder], test.accOrElmOrID, |
michael@0 | 104 | test.oldAccOrElmOrID, 0); |
michael@0 | 105 | }); |
michael@0 | 106 | }); |
michael@0 | 107 | |
michael@0 | 108 | // If there was an original utterance order preference, revert to it. |
michael@0 | 109 | SpecialPowers.clearUserPref(PREF_UTTERANCE_ORDER); |
michael@0 | 110 | SimpleTest.finish(); |
michael@0 | 111 | } |
michael@0 | 112 | |
michael@0 | 113 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 114 | addA11yLoadEvent(doTest); |
michael@0 | 115 | </script> |
michael@0 | 116 | </head> |
michael@0 | 117 | <body> |
michael@0 | 118 | <div id="root"> |
michael@0 | 119 | <a target="_blank" |
michael@0 | 120 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=888256" |
michael@0 | 121 | title="[AccessFu] Speak landmarks"> |
michael@0 | 122 | Mozilla Bug 888256 |
michael@0 | 123 | </a> |
michael@0 | 124 | <p id="display"></p> |
michael@0 | 125 | <div id="content" style="display: none"></div> |
michael@0 | 126 | <pre id="test"></pre> |
michael@0 | 127 | <nav id="nav">a nav</nav> |
michael@0 | 128 | <header id="header">a header</header> |
michael@0 | 129 | <footer id="footer">a footer</footer> |
michael@0 | 130 | <article id="article_with_header_and_footer"> |
michael@0 | 131 | <header id="article_header">a header within an article</header> |
michael@0 | 132 | <footer id="article_footer">a footer within an article</footer> |
michael@0 | 133 | </article> |
michael@0 | 134 | <section id="section_with_header_and_footer"> |
michael@0 | 135 | <header id="section_header">a header within a section</header> |
michael@0 | 136 | <footer id="section_footer">a footer within a section</footer> |
michael@0 | 137 | </section> |
michael@0 | 138 | <aside id="aside">by the way I am an aside</aside> |
michael@0 | 139 | <article id="main" role="main">a main area</article> |
michael@0 | 140 | <main id="main_element">another main area</main> |
michael@0 | 141 | <ul style="list-style-type: none;"> |
michael@0 | 142 | <li role="complementary" id="complementary"> |
michael@0 | 143 | A complementary |
michael@0 | 144 | </li> |
michael@0 | 145 | </ul> |
michael@0 | 146 | <main id="parent_main"> |
michael@0 | 147 | a parent main |
michael@0 | 148 | <p id="child_complementary" role="complementary">a child complementary</article> |
michael@0 | 149 | </main> |
michael@0 | 150 | </div> |
michael@0 | 151 | </body> |
michael@0 | 152 | </html> |