|
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="Menu focus 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 //gA11yEventDumpToConsole = true; // debug stuff |
|
25 |
|
26 var gQueue = null; |
|
27 function doTests() |
|
28 { |
|
29 // Test focus events. |
|
30 gQueue = new eventQueue(); |
|
31 |
|
32 if (WIN) { |
|
33 gQueue.push(new toggleTopMenu("fruit", new focusChecker("fruit"))); |
|
34 gQueue.push(new synthRightKey("fruit", new focusChecker("vehicle"))); |
|
35 gQueue.push(new synthEscapeKey("vehicle", new focusChecker(document))); |
|
36 } |
|
37 |
|
38 // mouse move activate items but no focus event until menubar is active |
|
39 gQueue.push(new synthMouseMove("fruit", new nofocusChecker("apple"))); |
|
40 |
|
41 // mouseover and click on menuitem makes it active before menubar is |
|
42 // active |
|
43 gQueue.push(new synthClick("fruit", new focusChecker("fruit"))); |
|
44 |
|
45 // mouseover on menuitem when menubar is active |
|
46 gQueue.push(new synthMouseMove("apple", new focusChecker("apple"))); |
|
47 |
|
48 // keydown on disabled menuitem (disabled items are skipped on linux) |
|
49 if (WIN) |
|
50 gQueue.push(new synthDownKey("apple", new focusChecker("orange"))); |
|
51 |
|
52 // menu and menuitem are both active |
|
53 // XXX: intermitent failure because two focus events may be coalesced, |
|
54 // think to workaround or fix this issue, when done enable queue invoker |
|
55 // below and remove next two. |
|
56 //gQueue.push(new synthRightKey("apple", |
|
57 // [ new focusChecker("vehicle"), |
|
58 // new focusChecker("cycle")])); |
|
59 gQueue.push(new synthClick("vehicle", new focusChecker("vehicle"))); |
|
60 gQueue.push(new synthDownKey("cycle", new focusChecker("cycle"))); |
|
61 |
|
62 // open submenu |
|
63 gQueue.push(new synthRightKey("cycle", new focusChecker("tricycle"))); |
|
64 |
|
65 // move to first menu in cycle, DOMMenuItemActive is fired for fruit, |
|
66 // cycle and apple menuitems (bug 685191) |
|
67 todo(false, "focus is fired for 'cycle' menuitem"); |
|
68 //gQueue.push(new synthRightKey("vehicle", new focusChecker("apple"))); |
|
69 |
|
70 // click menuitem to close menu, focus gets back to document |
|
71 gQueue.push(new synthClick("tricycle", new focusChecker(document))); |
|
72 |
|
73 //enableLogging("focus,DOMEvents,tree"); // logging for bug708927 |
|
74 //gQueue.onFinish = function() { disableLogging(); } |
|
75 |
|
76 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
77 } |
|
78 |
|
79 SimpleTest.waitForExplicitFinish(); |
|
80 addA11yLoadEvent(doTests); |
|
81 </script> |
|
82 |
|
83 <hbox flex="1" style="overflow: auto;"> |
|
84 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
85 <a target="_blank" |
|
86 href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958" |
|
87 title="Rework accessible focus handling"> |
|
88 Mozilla Bug 673958 |
|
89 </a> |
|
90 <p id="display"></p> |
|
91 <div id="content" style="display: none"></div> |
|
92 <pre id="test"> |
|
93 </pre> |
|
94 </body> |
|
95 |
|
96 <vbox flex="1"> |
|
97 <menubar> |
|
98 <menu id="fruit" label="Fruit"> |
|
99 <menupopup> |
|
100 <menuitem id="apple" label="Apple"/> |
|
101 <menuitem id="orange" label="Orange" disabled="true"/> |
|
102 </menupopup> |
|
103 </menu> |
|
104 <menu id="vehicle" label="Vehicle"> |
|
105 <menupopup> |
|
106 <menu id="cycle" label="cycle"> |
|
107 <menupopup> |
|
108 <menuitem id="tricycle" label="tricycle"/> |
|
109 </menupopup> |
|
110 </menu> |
|
111 <menuitem id="car" label="Car" disabled="true"/> |
|
112 </menupopup> |
|
113 </menu> |
|
114 </menubar> |
|
115 |
|
116 <vbox id="eventdump"/> |
|
117 </vbox> |
|
118 </hbox> |
|
119 </window> |