|
1 <html> |
|
2 |
|
3 <head> |
|
4 <title>Accessible focus testing</title> |
|
5 |
|
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 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
|
13 |
|
14 <script type="application/javascript" |
|
15 src="../common.js"></script> |
|
16 <script type="application/javascript" |
|
17 src="../events.js"></script> |
|
18 <script type="application/javascript" |
|
19 src="../role.js"></script> |
|
20 <script type="application/javascript" |
|
21 src="../states.js"></script> |
|
22 |
|
23 <script type="application/javascript"> |
|
24 //gA11yEventDumpID = "eventdump"; // debug stuff |
|
25 //gA11yEventDumpToConsole = true; |
|
26 |
|
27 var gQueue = null; |
|
28 |
|
29 function doTests() |
|
30 { |
|
31 // Bug 746534 - File causes crash or hang on OS X |
|
32 if (MAC) { |
|
33 todo(false, "Bug 746534 - test file causes crash or hang on OS X"); |
|
34 SimpleTest.finish(); |
|
35 return; |
|
36 } |
|
37 |
|
38 gQueue = new eventQueue(); |
|
39 |
|
40 // first item is focused until there's selection |
|
41 gQueue.push(new synthFocus("list", new focusChecker("orange"))); |
|
42 |
|
43 // item is selected and stays focused |
|
44 gQueue.push(new synthDownKey("list", new nofocusChecker())); |
|
45 |
|
46 // last selected item is focused |
|
47 gQueue.push(new synthDownKey("list", new focusChecker("apple"), { shiftKey: true })); |
|
48 |
|
49 // no focus event if nothing is changed |
|
50 gQueue.push(new synthDownKey("list", new nofocusChecker("apple"))); |
|
51 |
|
52 // current item is focused |
|
53 gQueue.push(new synthUpKey("list", new focusChecker("orange"), { ctrlKey: true })); |
|
54 |
|
55 // focus on empty list (no items to be focused) |
|
56 gQueue.push(new synthTab("list", new focusChecker("emptylist"))); |
|
57 |
|
58 // current item is focused |
|
59 gQueue.push(new synthShiftTab("emptylist", new focusChecker("orange"))); |
|
60 |
|
61 // collapsed combobox keeps a focus |
|
62 gQueue.push(new synthFocus("combobox", new focusChecker("combobox"))); |
|
63 gQueue.push(new synthDownKey("combobox", new nofocusChecker("combobox"))); |
|
64 |
|
65 // selected item is focused for expanded combobox |
|
66 gQueue.push(new synthOpenComboboxKey("combobox", new focusChecker("cb_apple"))); |
|
67 gQueue.push(new synthUpKey("combobox", new focusChecker("cb_orange"))); |
|
68 |
|
69 // collapsed combobx keeps a focus |
|
70 gQueue.push(new synthEscapeKey("combobox", new focusChecker("combobox"))); |
|
71 |
|
72 // no focus events for unfocused list controls when current item is |
|
73 // changed |
|
74 gQueue.push(new synthFocus("emptylist")); |
|
75 |
|
76 gQueue.push(new changeCurrentItem("list", "orange")); |
|
77 gQueue.push(new changeCurrentItem("combobox", "cb_apple")); |
|
78 |
|
79 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
80 } |
|
81 |
|
82 SimpleTest.waitForExplicitFinish(); |
|
83 addA11yLoadEvent(doTests); |
|
84 </script> |
|
85 </head> |
|
86 |
|
87 <body> |
|
88 |
|
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 <p id="display"></p> |
|
100 <div id="content" style="display: none"></div> |
|
101 <pre id="test"> |
|
102 </pre> |
|
103 |
|
104 <select id="list" size="5" multiple=""> |
|
105 <option id="orange">Orange</option> |
|
106 <option id="apple">Apple</option> |
|
107 </select> |
|
108 |
|
109 <select id="emptylist" size="5"></select> |
|
110 |
|
111 <select id="combobox"> |
|
112 <option id="cb_orange">Orange</option> |
|
113 <option id="cb_apple">Apple</option> |
|
114 </select> |
|
115 |
|
116 <div id="eventdump"></div> |
|
117 </body> |
|
118 </html> |