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