1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/actions/test_keys_menu.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,99 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.10 + title="Accessible XUL access keys and shortcut keys tests"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../common.js" /> 1.17 + <script type="application/javascript" 1.18 + src="../events.js" /> 1.19 + 1.20 + <script type="application/javascript"> 1.21 + <![CDATA[ 1.22 + function openMenu(aMenuID, aMenuitemID) 1.23 + { 1.24 + this.menuNode = getNode(aMenuID), 1.25 + this.menuitemNode = getNode(aMenuitemID), 1.26 + 1.27 + this.eventSeq = [ 1.28 + new invokerChecker(EVENT_FOCUS, this.menuNode) 1.29 + ]; 1.30 + 1.31 + this.invoke = function openMenu_invoke() 1.32 + { 1.33 + // Show menu. 1.34 + this.menuNode.open = true; 1.35 + } 1.36 + 1.37 + this.finalCheck = function openMenu_finalCheck() 1.38 + { 1.39 + var menu = getAccessible(aMenuID); 1.40 + is(menu.accessKey, (MAC ? "u" : "Alt+u"), 1.41 + "Wrong accesskey on " + prettyName(this.menuitemNode)); 1.42 + 1.43 + var menuitem = getAccessible(aMenuitemID); 1.44 + is(menuitem.accessKey, "p", 1.45 + "Wrong accesskey on " + prettyName(this.menuitemNode)); 1.46 + is(menuitem.keyboardShortcut, (MAC ? "⌃l" : "Ctrl+l"), 1.47 + "Wrong keyboard shortcut on " + prettyName(this.menuitemNode)); 1.48 + } 1.49 + 1.50 + this.getID = function openMenu_getID() 1.51 + { 1.52 + return "menuitem accesskey and shortcut test " + 1.53 + prettyName(this.menuItemNode); 1.54 + } 1.55 + } 1.56 + 1.57 + var gQueue = null; 1.58 + function doTest() 1.59 + { 1.60 + gQueue = new eventQueue(); 1.61 + gQueue.push(new openMenu("menu", "menuitem")); 1.62 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.63 + } 1.64 + 1.65 + SimpleTest.waitForExplicitFinish(); 1.66 + addA11yLoadEvent(doTest); 1.67 + ]]> 1.68 + </script> 1.69 + 1.70 + <hbox flex="1" style="overflow: auto;"> 1.71 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.72 + <a target="_blank" 1.73 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=672092" 1.74 + title="Reorganize access key and keyboard shortcut handling code"> 1.75 + Mozilla Bug 672092 1.76 + </a><br/> 1.77 + <p id="display"></p> 1.78 + <div id="content" style="display: none"> 1.79 + </div> 1.80 + <pre id="test"> 1.81 + </pre> 1.82 + </body> 1.83 + 1.84 + <vbox flex="1"> 1.85 + <keyset> 1.86 + <key key="l" modifiers="control" id="key1"/> 1.87 + </keyset> 1.88 + 1.89 + <menubar> 1.90 + <menu label="menu" id="menu" accesskey="u"> 1.91 + <menupopup> 1.92 + <menuitem accesskey="p" key="key1" label="item1" id="menuitem"/> 1.93 + </menupopup> 1.94 + </menu> 1.95 + </menubar> 1.96 + 1.97 + <vbox id="debug"/> 1.98 + </vbox> 1.99 + </hbox> 1.100 + 1.101 +</window> 1.102 +