|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 |
|
4 <head> |
|
5 <title>HTML text containers tests</title> |
|
6 <link rel="stylesheet" type="text/css" |
|
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../common.js"></script> |
|
14 <script type="application/javascript" |
|
15 src="../role.js"></script> |
|
16 |
|
17 <script type="application/javascript"> |
|
18 function doTest() |
|
19 { |
|
20 var accTree = { |
|
21 role: ROLE_SECTION, |
|
22 children: [ |
|
23 { // text child |
|
24 role: ROLE_TEXT_LEAF, |
|
25 children: [] |
|
26 } |
|
27 ] |
|
28 }; |
|
29 |
|
30 testAccessibleTree("c1", accTree); |
|
31 testAccessibleTree("c2", accTree); |
|
32 |
|
33 accTree = { |
|
34 role: ROLE_SECTION, |
|
35 children: [ |
|
36 { |
|
37 role: ROLE_TEXT_LEAF, |
|
38 name: "Hello1" |
|
39 }, |
|
40 { |
|
41 role: ROLE_WHITESPACE |
|
42 }, |
|
43 { |
|
44 role: ROLE_TEXT_LEAF, |
|
45 name: "Hello2" |
|
46 }, |
|
47 { |
|
48 role: ROLE_SEPARATOR |
|
49 }, |
|
50 { |
|
51 role: ROLE_TEXT_LEAF, |
|
52 name: "Hello3 " |
|
53 }, |
|
54 { |
|
55 role: ROLE_PARAGRAPH, |
|
56 children: [ |
|
57 { |
|
58 role: ROLE_TEXT_LEAF, |
|
59 name: "Hello4 " |
|
60 } |
|
61 ] |
|
62 } |
|
63 ] |
|
64 }; |
|
65 |
|
66 testAccessibleTree("c3", accTree); |
|
67 |
|
68 // contentEditable div |
|
69 accTree = { |
|
70 role: ROLE_SECTION, |
|
71 children: [ |
|
72 { |
|
73 role: ROLE_TEXT_LEAF, |
|
74 name: "helllo " |
|
75 }, |
|
76 { |
|
77 role: ROLE_PARAGRAPH, |
|
78 children: [ |
|
79 { |
|
80 role: ROLE_TEXT_LEAF, |
|
81 name: "blabla" |
|
82 } |
|
83 ] |
|
84 }, |
|
85 { |
|
86 role: ROLE_TEXT_LEAF, |
|
87 name: "hello " |
|
88 } |
|
89 ] |
|
90 }; |
|
91 |
|
92 testAccessibleTree("c4", accTree); |
|
93 |
|
94 // blockquote |
|
95 accTree = { |
|
96 role: ROLE_SECTION, |
|
97 children: [ |
|
98 { // block quote |
|
99 role: ROLE_SECTION, |
|
100 children: [ |
|
101 { // text child |
|
102 role: ROLE_TEXT_LEAF, |
|
103 name: "Hello", |
|
104 children: [] |
|
105 } |
|
106 ] |
|
107 } |
|
108 ] |
|
109 }; |
|
110 |
|
111 testAccessibleTree("c5", accTree); |
|
112 |
|
113 // abbreviation tag |
|
114 accTree = { |
|
115 role: ROLE_SECTION, |
|
116 children: [ |
|
117 { // text leaf |
|
118 role: ROLE_TEXT_LEAF, |
|
119 name: "This ", |
|
120 children: [] |
|
121 }, |
|
122 { // abbr tag |
|
123 role: ROLE_TEXT_CONTAINER, |
|
124 name: "accessibility", |
|
125 children: [ |
|
126 { // text leaf with actual text |
|
127 role: ROLE_TEXT_LEAF, |
|
128 name: "a11y", |
|
129 children: [] |
|
130 } |
|
131 ] |
|
132 }, |
|
133 { // text leaf |
|
134 role: ROLE_TEXT_LEAF, |
|
135 name: " test", |
|
136 children: [] |
|
137 } |
|
138 ] |
|
139 }; |
|
140 |
|
141 testAccessibleTree("c6", accTree); |
|
142 |
|
143 // acronym tag |
|
144 accTree = { |
|
145 role: ROLE_SECTION, |
|
146 children: [ |
|
147 { // text leaf |
|
148 role: ROLE_TEXT_LEAF, |
|
149 name: "This ", |
|
150 children: [] |
|
151 }, |
|
152 { // acronym tag |
|
153 role: ROLE_TEXT_CONTAINER, |
|
154 name: "personal computer", |
|
155 children: [ |
|
156 { // text leaf with actual text |
|
157 role: ROLE_TEXT_LEAF, |
|
158 name: "PC", |
|
159 children: [] |
|
160 } |
|
161 ] |
|
162 }, |
|
163 { // text leaf |
|
164 role: ROLE_TEXT_LEAF, |
|
165 name: " is broken", |
|
166 children: [] |
|
167 } |
|
168 ] |
|
169 }; |
|
170 |
|
171 testAccessibleTree("c7", accTree); |
|
172 |
|
173 // only whitespace between images should be exposed |
|
174 accTree = { |
|
175 SECTION: [ |
|
176 { GRAPHIC: [] }, |
|
177 { TEXT_LEAF: [] }, |
|
178 { GRAPHIC: [] } |
|
179 ] |
|
180 }; |
|
181 testAccessibleTree("c8", accTree); |
|
182 |
|
183 SimpleTest.finish(); |
|
184 } |
|
185 |
|
186 SimpleTest.waitForExplicitFinish(); |
|
187 addA11yLoadEvent(doTest); |
|
188 </script> |
|
189 </head> |
|
190 <body> |
|
191 |
|
192 <a target="_blank" |
|
193 title="overflowed content doesn't expose child text accessibles" |
|
194 href="https://bugzilla.mozilla.org/show_bug.cgi?id=489306"> |
|
195 Mozilla Bug 489306</a> |
|
196 <a target="_blank" |
|
197 title="Create child accessibles for text controls from native anonymous content" |
|
198 href="https://bugzilla.mozilla.org/show_bug.cgi?id=542824"> |
|
199 Mozilla Bug 542824</a> |
|
200 <a target="_blank" |
|
201 title="Update accessible tree on content insertion after layout" |
|
202 href="https://bugzilla.mozilla.org/show_bug.cgi?id=498015"> |
|
203 Mozilla Bug 498015</a> |
|
204 |
|
205 <p id="display"></p> |
|
206 <div id="content" style="display: none"></div> |
|
207 <pre id="test"> |
|
208 </pre> |
|
209 |
|
210 <div id="c1" style="width: 100px; height: 100px; overflow: auto;"> |
|
211 1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello |
|
212 </div> |
|
213 <div id="c2"> |
|
214 1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello |
|
215 </div> |
|
216 <div id="c3"> |
|
217 Hello1<br> |
|
218 Hello2<hr> |
|
219 Hello3 |
|
220 <p> |
|
221 Hello4 |
|
222 </p> |
|
223 </div> |
|
224 <div id="c4" contentEditable="true"> |
|
225 helllo <p>blabla</p> hello |
|
226 </div> |
|
227 <div id="c5"><blockquote>Hello</blockquote></div> |
|
228 <div id="c6">This <abbr title="accessibility">a11y</abbr> test</div> |
|
229 <div id="c7">This <acronym title="personal computer">PC</acronym> is broken</div> |
|
230 |
|
231 <!-- only whitespace between images should be exposed --> |
|
232 <div id="c8"> <img src="../moz.png"> <img src="../moz.png"> </div> |
|
233 </body> |
|
234 </html> |