accessible/tests/mochitest/events/test_focus_contextmenu.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
michael@0 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
michael@0 4 type="text/css"?>
michael@0 5
michael@0 6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 7 title="Context nenu focus testing">
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
michael@0 11 <script type="application/javascript"
michael@0 12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
michael@0 13
michael@0 14 <script type="application/javascript"
michael@0 15 src="../common.js" />
michael@0 16 <script type="application/javascript"
michael@0 17 src="../role.js" />
michael@0 18 <script type="application/javascript"
michael@0 19 src="../states.js" />
michael@0 20 <script type="application/javascript"
michael@0 21 src="../events.js" />
michael@0 22
michael@0 23 <script type="application/javascript">
michael@0 24 //gA11yEventDumpID = "eventdump"; // debug stuff
michael@0 25 //gA11yEventDumpToConsole = true; // debug stuff
michael@0 26
michael@0 27 var winLowerThanVista = navigator.platform.indexOf("Win") == 0;
michael@0 28 if (winLowerThanVista) {
michael@0 29 var version = Components.classes["@mozilla.org/system-info;1"]
michael@0 30 .getService(Components.interfaces.nsIPropertyBag2)
michael@0 31 .getProperty("version");
michael@0 32 version = parseFloat(version);
michael@0 33 winLowerThanVista = !(version >= 6.0);
michael@0 34 }
michael@0 35
michael@0 36 var gQueue = null;
michael@0 37 function doTests()
michael@0 38 {
michael@0 39 // bug 746183 - Whole file times out on OS X
michael@0 40 if (MAC || winLowerThanVista) {
michael@0 41 todo(false, "Reenable on mac after fixing bug 746183!");
michael@0 42 SimpleTest.finish();
michael@0 43 return;
michael@0 44 }
michael@0 45
michael@0 46 // Test focus events.
michael@0 47 gQueue = new eventQueue();
michael@0 48
michael@0 49 gQueue.push(new synthFocus("button"));
michael@0 50 gQueue.push(new synthContextMenu("button",
michael@0 51 new invokerChecker(EVENT_MENUPOPUP_START, "contextmenu")));
michael@0 52 gQueue.push(new synthEscapeKey("contextmenu", new focusChecker("button")));
michael@0 53
michael@0 54 gQueue.push(new synthContextMenu("button",
michael@0 55 new invokerChecker(EVENT_MENUPOPUP_START, "contextmenu")));
michael@0 56 gQueue.push(new synthDownKey("contextmenu", new focusChecker("item1")));
michael@0 57 gQueue.push(new synthDownKey("item1", new focusChecker("item2")));
michael@0 58 gQueue.push(new synthRightKey("item2", new focusChecker("item2.1")));
michael@0 59 if (WIN) {
michael@0 60 todo(false, "synthEscapeKey for item2.1 and item2 disabled due to bug 691580");
michael@0 61 } else {
michael@0 62 gQueue.push(new synthEscapeKey("item2.1", new focusChecker("item2")));
michael@0 63 gQueue.push(new synthEscapeKey("item2", new focusChecker("button")));
michael@0 64 }
michael@0 65 gQueue.invoke(); // Will call SimpleTest.finish();
michael@0 66 }
michael@0 67
michael@0 68 SimpleTest.waitForExplicitFinish();
michael@0 69 addA11yLoadEvent(doTests);
michael@0 70 </script>
michael@0 71
michael@0 72 <hbox flex="1" style="overflow: auto;">
michael@0 73 <body xmlns="http://www.w3.org/1999/xhtml">
michael@0 74 <a target="_blank"
michael@0 75 href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958"
michael@0 76 title="Rework accessible focus handling">
michael@0 77 Mozilla Bug 673958
michael@0 78 </a>
michael@0 79 <p id="display"></p>
michael@0 80 <div id="content" style="display: none"></div>
michael@0 81 <pre id="test">
michael@0 82 </pre>
michael@0 83 </body>
michael@0 84
michael@0 85 <vbox flex="1">
michael@0 86 <button id="button" context="contextmenu" label="button"/>
michael@0 87 <menupopup id="contextmenu">
michael@0 88 <menuitem id="item1" label="item1"/>
michael@0 89 <menu id="item2" label="item2">
michael@0 90 <menupopup>
michael@0 91 <menuitem id="item2.1" label="item2.1"/>
michael@0 92 </menupopup>
michael@0 93 </menu>
michael@0 94 </menupopup>
michael@0 95
michael@0 96 <vbox id="eventdump"/>
michael@0 97 </vbox>
michael@0 98 </hbox>
michael@0 99 </window>

mercurial