accessible/tests/mochitest/actions/test_keys_menu.xul

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:88a93ceaa092
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 access keys and shortcut keys 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="../events.js" />
16
17 <script type="application/javascript">
18 <![CDATA[
19 function openMenu(aMenuID, aMenuitemID)
20 {
21 this.menuNode = getNode(aMenuID),
22 this.menuitemNode = getNode(aMenuitemID),
23
24 this.eventSeq = [
25 new invokerChecker(EVENT_FOCUS, this.menuNode)
26 ];
27
28 this.invoke = function openMenu_invoke()
29 {
30 // Show menu.
31 this.menuNode.open = true;
32 }
33
34 this.finalCheck = function openMenu_finalCheck()
35 {
36 var menu = getAccessible(aMenuID);
37 is(menu.accessKey, (MAC ? "u" : "Alt+u"),
38 "Wrong accesskey on " + prettyName(this.menuitemNode));
39
40 var menuitem = getAccessible(aMenuitemID);
41 is(menuitem.accessKey, "p",
42 "Wrong accesskey on " + prettyName(this.menuitemNode));
43 is(menuitem.keyboardShortcut, (MAC ? "⌃l" : "Ctrl+l"),
44 "Wrong keyboard shortcut on " + prettyName(this.menuitemNode));
45 }
46
47 this.getID = function openMenu_getID()
48 {
49 return "menuitem accesskey and shortcut test " +
50 prettyName(this.menuItemNode);
51 }
52 }
53
54 var gQueue = null;
55 function doTest()
56 {
57 gQueue = new eventQueue();
58 gQueue.push(new openMenu("menu", "menuitem"));
59 gQueue.invoke(); // Will call SimpleTest.finish();
60 }
61
62 SimpleTest.waitForExplicitFinish();
63 addA11yLoadEvent(doTest);
64 ]]>
65 </script>
66
67 <hbox flex="1" style="overflow: auto;">
68 <body xmlns="http://www.w3.org/1999/xhtml">
69 <a target="_blank"
70 href="https://bugzilla.mozilla.org/show_bug.cgi?id=672092"
71 title="Reorganize access key and keyboard shortcut handling code">
72 Mozilla Bug 672092
73 </a><br/>
74 <p id="display"></p>
75 <div id="content" style="display: none">
76 </div>
77 <pre id="test">
78 </pre>
79 </body>
80
81 <vbox flex="1">
82 <keyset>
83 <key key="l" modifiers="control" id="key1"/>
84 </keyset>
85
86 <menubar>
87 <menu label="menu" id="menu" accesskey="u">
88 <menupopup>
89 <menuitem accesskey="p" key="key1" label="item1" id="menuitem"/>
90 </menupopup>
91 </menu>
92 </menubar>
93
94 <vbox id="debug"/>
95 </vbox>
96 </hbox>
97
98 </window>
99

mercurial