accessible/tests/mochitest/events/test_focus_contextmenu.xul

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial