|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>HTML ul/li element tests</title> |
|
5 <link rel="stylesheet" type="text/css" |
|
6 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
7 |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
10 |
|
11 <script type="application/javascript" |
|
12 src="../common.js"></script> |
|
13 <script type="application/javascript" |
|
14 src="../role.js"></script> |
|
15 |
|
16 <script type="application/javascript"> |
|
17 function listItemTree(aBulletText, aName, aSubtree) |
|
18 { |
|
19 var obj = { |
|
20 role: ROLE_LISTITEM, |
|
21 children: [ |
|
22 { |
|
23 role: ROLE_STATICTEXT, |
|
24 name: aBulletText |
|
25 }, |
|
26 { |
|
27 role: ROLE_TEXT_LEAF, |
|
28 name: aName |
|
29 } |
|
30 ] |
|
31 }; |
|
32 |
|
33 if (aSubtree) |
|
34 obj.children.push(aSubtree); |
|
35 |
|
36 return obj; |
|
37 } |
|
38 |
|
39 function doTest() |
|
40 { |
|
41 // list1 |
|
42 var discAccTree = { |
|
43 role: ROLE_LIST, |
|
44 children: [ |
|
45 new listItemTree(kDiscBulletText, "Oranges"), |
|
46 new listItemTree(kDiscBulletText, "Apples"), |
|
47 new listItemTree(kDiscBulletText, "Bananas") |
|
48 ] |
|
49 }; |
|
50 |
|
51 testAccessibleTree("list1", discAccTree); |
|
52 |
|
53 // list2 |
|
54 var circleAccTree = { |
|
55 role: ROLE_LIST, |
|
56 children: [ |
|
57 new listItemTree(kCircleBulletText, "Oranges"), |
|
58 new listItemTree(kCircleBulletText, "Apples"), |
|
59 new listItemTree(kCircleBulletText, "Bananas") |
|
60 ] |
|
61 }; |
|
62 |
|
63 testAccessibleTree("list2", circleAccTree); |
|
64 |
|
65 // list3 |
|
66 var squareAccTree = { |
|
67 role: ROLE_LIST, |
|
68 children: [ |
|
69 new listItemTree(kSquareBulletText, "Oranges"), |
|
70 new listItemTree(kSquareBulletText, "Apples"), |
|
71 new listItemTree(kSquareBulletText, "Bananas") |
|
72 ] |
|
73 }; |
|
74 |
|
75 testAccessibleTree("list3", squareAccTree); |
|
76 |
|
77 // list4 |
|
78 var nestedAccTree = { |
|
79 role: ROLE_LIST, |
|
80 children: [ |
|
81 new listItemTree("1. ", "Oranges"), |
|
82 new listItemTree("2. ", "Apples"), |
|
83 new listItemTree("3. ", "Bananas", circleAccTree) |
|
84 ] |
|
85 }; |
|
86 |
|
87 testAccessibleTree("list4", nestedAccTree); |
|
88 |
|
89 // dl list |
|
90 var tree = |
|
91 { DEFINITION_LIST: [ // dl |
|
92 { TERM: [ // dt |
|
93 { TEXT_LEAF: [] }, |
|
94 ] }, |
|
95 { DEFINITION: [ // dd |
|
96 { TEXT_LEAF: [] } |
|
97 ] }, |
|
98 { TERM: [ // dt |
|
99 { TEXT_LEAF: [] } |
|
100 ] }, |
|
101 { DEFINITION: [ // dd |
|
102 { TEXT_LEAF: [] } |
|
103 ] } |
|
104 ] }; |
|
105 |
|
106 testAccessibleTree("list5", tree); |
|
107 |
|
108 // dl list inside ordered list |
|
109 tree = |
|
110 { LIST: [ // ol |
|
111 { LISTITEM: [ // li |
|
112 { STATICTEXT: [ ] }, |
|
113 { DEFINITION_LIST: [ // dl |
|
114 { TERM: [ // dt |
|
115 { TEXT_LEAF: [] } |
|
116 ] }, |
|
117 { DEFINITION: [ // dd |
|
118 { TEXT_LEAF: [] } |
|
119 ] } |
|
120 ] } |
|
121 ] } |
|
122 ] }; |
|
123 |
|
124 testAccessibleTree("list6", tree); |
|
125 |
|
126 // li having no display:list-item style |
|
127 var tree = |
|
128 { LIST: [ // ul |
|
129 { LISTITEM: [ // li |
|
130 { TEXT_LEAF: [] }, |
|
131 ] }, |
|
132 { TEXT_LEAF: [] }, |
|
133 { LISTITEM: [ // li |
|
134 { TEXT_LEAF: [] } |
|
135 ] } |
|
136 ] }; |
|
137 testAccessibleTree("list7", tree); |
|
138 |
|
139 var tree = |
|
140 { LIST: [ // ul |
|
141 { LISTITEM: [ // li |
|
142 { TEXT_LEAF: [] }, |
|
143 ] }, |
|
144 { LISTITEM: [ // li |
|
145 { TEXT_LEAF: [] } |
|
146 ] } |
|
147 ] }; |
|
148 testAccessibleTree("list8", tree); |
|
149 |
|
150 // span having display:list-item style |
|
151 testAccessibleTree("list9", discAccTree); |
|
152 |
|
153 SimpleTest.finish(); |
|
154 } |
|
155 |
|
156 SimpleTest.waitForExplicitFinish(); |
|
157 addA11yLoadEvent(doTest); |
|
158 </script> |
|
159 </head> |
|
160 <body> |
|
161 |
|
162 <a target="_blank" |
|
163 title="Fix O(n^2) access to all the children of a container" |
|
164 href="https://bugzilla.mozilla.org/show_bug.cgi?id=342045"> |
|
165 Mozilla Bug 342045 |
|
166 </a> |
|
167 <a target="_blank" |
|
168 title="Wrong accessible is created for HTML:li having block display style" |
|
169 href="https://bugzilla.mozilla.org/show_bug.cgi?id=507555"> |
|
170 Mozilla Bug 507555 |
|
171 </a> |
|
172 <a target="_blank" |
|
173 title="Bullets of nested not ordered lists have one and the same character." |
|
174 href="https://bugzilla.mozilla.org/show_bug.cgi?id=604587"> |
|
175 Mozilla Bug 604587 |
|
176 </a> |
|
177 <a target="_blank" |
|
178 title="Fix list bullets for DL list (crash [@ nsBulletFrame::GetListItemText])" |
|
179 href="https://bugzilla.mozilla.org/show_bug.cgi?id=629114"> |
|
180 Mozilla Bug 629114 |
|
181 </a> |
|
182 <p id="display"></p> |
|
183 <div id="content" style="display: none"></div> |
|
184 <pre id="test"> |
|
185 </pre> |
|
186 |
|
187 <ul id="list1"> |
|
188 <li id="l1_li1">Oranges</li> |
|
189 <li id="l1_li2">Apples</li> |
|
190 <li id="l1_li3">Bananas</li> |
|
191 </ul> |
|
192 |
|
193 <ul id="list2" style="list-style-type: circle"> |
|
194 <li id="l2_li1">Oranges</li> |
|
195 <li id="l2_li2">Apples</li> |
|
196 <li id="l2_li3">Bananas</li> |
|
197 </ul> |
|
198 |
|
199 <ul id="list3" style="list-style-type: square"> |
|
200 <li id="l3_li1">Oranges</li> |
|
201 <li id="l3_li2">Apples</li> |
|
202 <li id="l3_li3">Bananas</li> |
|
203 </ul> |
|
204 |
|
205 <ol id="list4"> |
|
206 <li id="li4">Oranges</li> |
|
207 <li id="li5">Apples</li> |
|
208 <li id="li6">Bananas<ul> |
|
209 <li id="n_li4">Oranges</li> |
|
210 <li id="n_li5">Apples</li> |
|
211 <li id="n_li6">Bananas</li> |
|
212 </ul> |
|
213 </li> |
|
214 </ol> |
|
215 |
|
216 <dl id="list5"> |
|
217 <dt>item1</dt><dd>description</dd> |
|
218 <dt>item2</td><dd>description</dd> |
|
219 </dl> |
|
220 |
|
221 <ol id="list6"> |
|
222 <li> |
|
223 <dl id="dl"> |
|
224 <dt>item1</dt><dd>description</dd> |
|
225 </dl> |
|
226 </li> |
|
227 </ol> |
|
228 |
|
229 <!-- display style different than list-item --> |
|
230 <ul id="list7"> |
|
231 <li id="l7_li1" style="display:inline-block;">Oranges</li> |
|
232 <li id="l7_li2" style="display:inline-block;">Apples</li> |
|
233 </ul> |
|
234 |
|
235 <ul id="list8"> |
|
236 <li id="l8_li1" style="display:inline; float:right;">Oranges</li> |
|
237 <li id="l8_li2" style="display:inline; float:right;">Apples</li> |
|
238 </ul> |
|
239 |
|
240 <!-- list-item display style --> |
|
241 <ul id="list9"> |
|
242 <span id="l9_li1" style="display:list-item">Oranges</span> |
|
243 <span id="l9_li2" style="display:list-item">Apples</span> |
|
244 <span id="l9_li3" style="display:list-item">Bananas</span> |
|
245 </ul> |
|
246 </body> |
|
247 </html> |