|
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 focus event testing"> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
|
13 |
|
14 <script type="application/javascript" |
|
15 src="../common.js" /> |
|
16 <script type="application/javascript" |
|
17 src="../role.js" /> |
|
18 <script type="application/javascript" |
|
19 src="../states.js" /> |
|
20 <script type="application/javascript" |
|
21 src="../events.js" /> |
|
22 |
|
23 <script type="application/javascript"> |
|
24 //gA11yEventDumpID = "eventdump"; // debug stuff |
|
25 gA11yEventDumpToConsole = true; // debug stuff |
|
26 |
|
27 var gQueue = null; |
|
28 function doTests() |
|
29 { |
|
30 // Test focus events. |
|
31 gQueue = new eventQueue(); |
|
32 |
|
33 gQueue.push(new synthFocus("listbox", new focusChecker("lb_item1"))); |
|
34 gQueue.push(new synthDownKey("lb_item1", new focusChecker("lb_item2"))); |
|
35 gQueue.push(new synthTab("lb_item2", new focusChecker("mslb_item1"))); |
|
36 gQueue.push(new synthDownKey("mslb_item1", new focusChecker("mslb_item2"), { shiftKey: true })); |
|
37 gQueue.push(new synthTab("mslb_item2", new focusChecker("emptylistbox"))); |
|
38 gQueue.push(new synthFocus("mcolumnlistbox", new focusChecker("mclb_item1"))); |
|
39 gQueue.push(new synthDownKey("mclb_item1", new focusChecker("mclb_item2"))); |
|
40 gQueue.push(new synthFocus("headerlistbox", new focusChecker("hlb_item1"))); |
|
41 gQueue.push(new synthDownKey("hlb_item1", new focusChecker("hlb_item2"))); |
|
42 |
|
43 gQueue.push(new synthFocus("richlistbox", new focusChecker("rlb_item1"))); |
|
44 gQueue.push(new synthDownKey("rlb_item1", new focusChecker("rlb_item2"))); |
|
45 gQueue.push(new synthFocus("multiselrichlistbox", new focusChecker("msrlb_item1"))); |
|
46 gQueue.push(new synthDownKey("msrlb_item1", new focusChecker("msrlb_item2"), { shiftKey: true })); |
|
47 gQueue.push(new synthFocus("emptyrichlistbox", new focusChecker("emptyrichlistbox"))); |
|
48 |
|
49 gQueue.push(new synthFocus("menulist")); |
|
50 gQueue.push(new synthClick("menulist", new focusChecker("ml_tangerine"))); |
|
51 gQueue.push(new synthDownKey("ml_tangerine", new focusChecker("ml_marmalade"))); |
|
52 gQueue.push(new synthEscapeKey("ml_marmalade", new focusChecker("menulist"))); |
|
53 if (!MAC) { |
|
54 gQueue.push(new synthDownKey("menulist", new nofocusChecker("ml_marmalade"))); |
|
55 gQueue.push(new synthOpenComboboxKey("menulist", new focusChecker("ml_marmalade"))); |
|
56 gQueue.push(new synthEnterKey("ml_marmalade", new focusChecker("menulist"))); |
|
57 } else { |
|
58 todo(false, "Bug 746531 - timeouts of last three menulist tests on OS X"); |
|
59 } |
|
60 |
|
61 var textentry = getAccessible("emenulist").firstChild; |
|
62 gQueue.push(new synthFocus("emenulist", new focusChecker(textentry))); |
|
63 gQueue.push(new synthDownKey(textentry, new nofocusChecker("eml_tangerine"))); |
|
64 gQueue.push(new synthUpKey(textentry, new focusChecker("eml_marmalade"))); |
|
65 gQueue.push(new synthEnterKey("eml_marmalade", new focusChecker(textentry))); |
|
66 gQueue.push(new synthOpenComboboxKey("emenulist", new focusChecker("eml_marmalade"))); |
|
67 gQueue.push(new synthEscapeKey("eml_marmalade", new focusChecker(textentry))); |
|
68 |
|
69 // no focus events for unfocused list controls when current item is |
|
70 // changed. |
|
71 gQueue.push(new synthFocus("emptylistbox")); |
|
72 |
|
73 gQueue.push(new changeCurrentItem("listbox", "lb_item1")); |
|
74 gQueue.push(new changeCurrentItem("richlistbox", "rlb_item1")); |
|
75 if (!MAC) { |
|
76 gQueue.push(new changeCurrentItem("menulist", "ml_tangerine")); |
|
77 } |
|
78 gQueue.push(new changeCurrentItem("emenulist", "eml_tangerine")); |
|
79 |
|
80 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
81 } |
|
82 |
|
83 SimpleTest.waitForExplicitFinish(); |
|
84 addA11yLoadEvent(doTests); |
|
85 </script> |
|
86 |
|
87 <hbox flex="1" style="overflow: auto;"> |
|
88 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
89 <a target="_blank" |
|
90 href="https://bugzilla.mozilla.org/show_bug.cgi?id=433418" |
|
91 title="Accessibles for focused HTML Select elements are not getting focused state"> |
|
92 Mozilla Bug 433418 |
|
93 </a> |
|
94 <a target="_blank" |
|
95 href="https://bugzilla.mozilla.org/show_bug.cgi?id=474893" |
|
96 title="List controls should fire a focus event on the selected child when tabbing or when the selected child changes while the list is focused"> |
|
97 Mozilla Bug 474893 |
|
98 </a> |
|
99 <a target="_blank" |
|
100 href="https://bugzilla.mozilla.org/show_bug.cgi?id=552368" |
|
101 title=" fire focus event on document accessible whenever the root or body element is focused"> |
|
102 Mozilla Bug 552368 |
|
103 </a> |
|
104 <p id="display"></p> |
|
105 <div id="content" style="display: none"></div> |
|
106 <pre id="test"> |
|
107 </pre> |
|
108 </body> |
|
109 |
|
110 <vbox flex="1"> |
|
111 <listbox id="listbox" rows="3"> |
|
112 <listitem id="lb_item1" label="item1"/> |
|
113 <listitem id="lb_item2" label="item1"/> |
|
114 </listbox> |
|
115 <listbox id="multisellistbox" rows="3" seltype="multiple"> |
|
116 <listitem id="mslb_item1" label="item1"/> |
|
117 <listitem id="mslb_item2" label="item1"/> |
|
118 </listbox> |
|
119 <listbox id="emptylistbox" rows="3"/> |
|
120 <listbox id="mcolumnlistbox" rows="3"> |
|
121 <listcols> |
|
122 <listcol/> |
|
123 <listcol/> |
|
124 </listcols> |
|
125 <listitem id="mclb_item1"> |
|
126 <listcell label="George"/> |
|
127 <listcell label="House Painter"/> |
|
128 </listitem> |
|
129 <listitem id="mclb_item2"> |
|
130 <listcell label="Mary Ellen"/> |
|
131 <listcell label="Candle Maker"/> |
|
132 </listitem> |
|
133 </listbox> |
|
134 <listbox id="headerlistbox" rows="3"> |
|
135 <listhead> |
|
136 <listheader label="Name"/> |
|
137 <listheader label="Occupation"/> |
|
138 </listhead> |
|
139 <listcols> |
|
140 <listcol/> |
|
141 <listcol flex="1"/> |
|
142 </listcols> |
|
143 <listitem id="hlb_item1"> |
|
144 <listcell label="George"/> |
|
145 <listcell label="House Painter"/> |
|
146 </listitem> |
|
147 <listitem id="hlb_item2"> |
|
148 <listcell label="Mary Ellen"/> |
|
149 <listcell label="Candle Maker"/> |
|
150 </listitem> |
|
151 </listbox> |
|
152 |
|
153 <richlistbox id="richlistbox"> |
|
154 <richlistitem id="rlb_item1"> |
|
155 <description>A XUL Description!</description> |
|
156 </richlistitem> |
|
157 <richlistitem id="rlb_item2"> |
|
158 <button label="A XUL Button"/> |
|
159 </richlistitem> |
|
160 </richlistbox> |
|
161 <richlistbox id="multiselrichlistbox" seltype="multiple"> |
|
162 <richlistitem id="msrlb_item1"> |
|
163 <description>A XUL Description!</description> |
|
164 </richlistitem> |
|
165 <richlistitem id="msrlb_item2"> |
|
166 <button label="A XUL Button"/> |
|
167 </richlistitem> |
|
168 </richlistbox> |
|
169 <richlistbox id="emptyrichlistbox" seltype="multiple"/> |
|
170 |
|
171 <menulist id="menulist"> |
|
172 <menupopup> |
|
173 <menuitem id="ml_tangerine" label="tangerine trees"/> |
|
174 <menuitem id="ml_marmalade" label="marmalade skies"/> |
|
175 </menupopup> |
|
176 </menulist> |
|
177 <menulist id="emenulist" editable="true"> |
|
178 <menupopup> |
|
179 <menuitem id="eml_tangerine" label="tangerine trees"/> |
|
180 <menuitem id="eml_marmalade" label="marmalade skies"/> |
|
181 </menupopup> |
|
182 </menulist> |
|
183 |
|
184 <vbox id="eventdump"/> |
|
185 </vbox> |
|
186 </hbox> |
|
187 </window> |