|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
|
4 type="text/css"?> |
|
5 |
|
6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
7 title="Accessible XUL listbox hierarchy tests"> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../common.js" /> |
|
14 <script type="application/javascript" |
|
15 src="../role.js" /> |
|
16 <script type="application/javascript" |
|
17 src="../events.js" /> |
|
18 |
|
19 <script type="application/javascript"> |
|
20 <![CDATA[ |
|
21 //////////////////////////////////////////////////////////////////////////// |
|
22 // Test |
|
23 |
|
24 function insertListitem(aListboxID) |
|
25 { |
|
26 this.listboxNode = getNode(aListboxID); |
|
27 |
|
28 this.listitemNode = document.createElement("listitem"); |
|
29 this.listitemNode.setAttribute("label", "item1"); |
|
30 |
|
31 this.eventSeq = [ |
|
32 new invokerChecker(EVENT_SHOW, this.listitemNode), |
|
33 new invokerChecker(EVENT_REORDER, this.listboxNode) |
|
34 ]; |
|
35 |
|
36 this.invoke = function insertListitem_invoke() |
|
37 { |
|
38 this.listboxNode.insertBefore(this.listitemNode, |
|
39 this.listboxNode.firstChild); |
|
40 } |
|
41 |
|
42 this.finalCheck = function insertListitem_finalCheck() |
|
43 { |
|
44 var tree = |
|
45 { LISTBOX: [ |
|
46 { |
|
47 role: ROLE_RICH_OPTION, |
|
48 name: "item1" |
|
49 }, |
|
50 { |
|
51 role: ROLE_RICH_OPTION, |
|
52 name: "item2" |
|
53 }, |
|
54 { |
|
55 role: ROLE_RICH_OPTION, |
|
56 name: "item3" |
|
57 }, |
|
58 { |
|
59 role: ROLE_RICH_OPTION, |
|
60 name: "item4" |
|
61 } |
|
62 ] }; |
|
63 testAccessibleTree(this.listboxNode, tree); |
|
64 } |
|
65 |
|
66 this.getID = function insertListitem_getID() |
|
67 { |
|
68 return "insert listitem "; |
|
69 } |
|
70 } |
|
71 |
|
72 function removeListitem(aListboxID) |
|
73 { |
|
74 this.listboxNode = getNode(aListboxID); |
|
75 this.listitemNode = null; |
|
76 this.listitem; |
|
77 |
|
78 function getListitem(aThisObj) |
|
79 { |
|
80 return aThisObj.listitem; |
|
81 } |
|
82 |
|
83 this.eventSeq = [ |
|
84 new invokerChecker(EVENT_HIDE, getListitem, this), |
|
85 new invokerChecker(EVENT_REORDER, this.listboxNode) |
|
86 ]; |
|
87 |
|
88 this.invoke = function removeListitem_invoke() |
|
89 { |
|
90 this.listitemNode = this.listboxNode.firstChild; |
|
91 this.listitem = getAccessible(this.listitemNode); |
|
92 |
|
93 this.listboxNode.removeChild(this.listitemNode); |
|
94 } |
|
95 |
|
96 this.finalCheck = function removeListitem_finalCheck() |
|
97 { |
|
98 var tree = |
|
99 { LISTBOX: [ |
|
100 { |
|
101 role: ROLE_RICH_OPTION, |
|
102 name: "item2" |
|
103 }, |
|
104 { |
|
105 role: ROLE_RICH_OPTION, |
|
106 name: "item3" |
|
107 }, |
|
108 { |
|
109 role: ROLE_RICH_OPTION, |
|
110 name: "item4" |
|
111 } |
|
112 ] }; |
|
113 testAccessibleTree(this.listboxNode, tree); |
|
114 } |
|
115 |
|
116 this.getID = function removeListitem_getID() |
|
117 { |
|
118 return "remove listitem "; |
|
119 } |
|
120 } |
|
121 |
|
122 //gA11yEventDumpToConsole = true; // debug stuff |
|
123 |
|
124 var gQueue = null; |
|
125 function doTest() |
|
126 { |
|
127 var tree = |
|
128 { LISTBOX: [ |
|
129 { |
|
130 role: ROLE_RICH_OPTION, |
|
131 name: "item2" |
|
132 }, |
|
133 { |
|
134 role: ROLE_RICH_OPTION, |
|
135 name: "item3" |
|
136 }, |
|
137 { |
|
138 role: ROLE_RICH_OPTION, |
|
139 name: "item4" |
|
140 } |
|
141 ] }; |
|
142 testAccessibleTree("listbox", tree); |
|
143 |
|
144 gQueue = new eventQueue(); |
|
145 gQueue.push(new insertListitem("listbox")); |
|
146 gQueue.push(new removeListitem("listbox")); |
|
147 gQueue.invoke(); // Will call SimpleTest.finish() |
|
148 } |
|
149 |
|
150 SimpleTest.waitForExplicitFinish(); |
|
151 addA11yLoadEvent(doTest); |
|
152 ]]> |
|
153 </script> |
|
154 |
|
155 <hbox flex="1" style="overflow: auto;"> |
|
156 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
157 <a target="_blank" |
|
158 href="https://bugzilla.mozilla.org/show_bug.cgi?id=656225" |
|
159 title="XUL listbox accessible tree doesn't get updated"> |
|
160 Mozilla Bug 656225 |
|
161 </a> |
|
162 <br/> |
|
163 <p id="display"></p> |
|
164 <div id="content" style="display: none"> |
|
165 </div> |
|
166 <pre id="test"> |
|
167 </pre> |
|
168 </body> |
|
169 |
|
170 <vbox flex="1"> |
|
171 <listbox id="listbox" rows="2"> |
|
172 <listitem label="item2"/> |
|
173 <listitem label="item3"/> |
|
174 <listitem label="item4"/> |
|
175 </listbox> |
|
176 </vbox> |
|
177 </hbox> |
|
178 |
|
179 </window> |
|
180 |