accessible/tests/mochitest/events/test_focus_contextmenu.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/events/test_focus_contextmenu.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="Context nenu focus testing">
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    1.16 +
    1.17 +  <script type="application/javascript"
    1.18 +          src="../common.js" />
    1.19 +  <script type="application/javascript"
    1.20 +          src="../role.js" />
    1.21 +  <script type="application/javascript"
    1.22 +          src="../states.js" />
    1.23 +  <script type="application/javascript"
    1.24 +          src="../events.js" />
    1.25 +
    1.26 +  <script type="application/javascript">
    1.27 +    //gA11yEventDumpID = "eventdump"; // debug stuff
    1.28 +    //gA11yEventDumpToConsole = true; // debug stuff
    1.29 +    
    1.30 +    var winLowerThanVista = navigator.platform.indexOf("Win") == 0;
    1.31 +    if (winLowerThanVista) {
    1.32 +      var version = Components.classes["@mozilla.org/system-info;1"]
    1.33 +                              .getService(Components.interfaces.nsIPropertyBag2)
    1.34 +                              .getProperty("version");
    1.35 +      version = parseFloat(version);
    1.36 +      winLowerThanVista = !(version >= 6.0);
    1.37 +    }
    1.38 +
    1.39 +    var gQueue = null;
    1.40 +    function doTests()
    1.41 +    {
    1.42 +      // bug 746183 - Whole file times out on OS X
    1.43 +      if (MAC || winLowerThanVista) {
    1.44 +        todo(false, "Reenable on mac after fixing bug 746183!");
    1.45 +        SimpleTest.finish();
    1.46 +        return;
    1.47 +      }
    1.48 +
    1.49 +      // Test focus events.
    1.50 +      gQueue = new eventQueue();
    1.51 +
    1.52 +      gQueue.push(new synthFocus("button"));
    1.53 +      gQueue.push(new synthContextMenu("button",
    1.54 +                                       new invokerChecker(EVENT_MENUPOPUP_START, "contextmenu")));
    1.55 +      gQueue.push(new synthEscapeKey("contextmenu", new focusChecker("button")));
    1.56 +
    1.57 +      gQueue.push(new synthContextMenu("button",
    1.58 +                                       new invokerChecker(EVENT_MENUPOPUP_START, "contextmenu")));
    1.59 +      gQueue.push(new synthDownKey("contextmenu", new focusChecker("item1")));
    1.60 +      gQueue.push(new synthDownKey("item1", new focusChecker("item2")));
    1.61 +      gQueue.push(new synthRightKey("item2", new focusChecker("item2.1")));
    1.62 +      if (WIN) {
    1.63 +        todo(false, "synthEscapeKey for item2.1 and item2 disabled due to bug 691580");
    1.64 +      } else {
    1.65 +        gQueue.push(new synthEscapeKey("item2.1", new focusChecker("item2")));
    1.66 +        gQueue.push(new synthEscapeKey("item2", new focusChecker("button")));
    1.67 +      }
    1.68 +      gQueue.invoke(); // Will call SimpleTest.finish();
    1.69 +    }
    1.70 +
    1.71 +    SimpleTest.waitForExplicitFinish();
    1.72 +    addA11yLoadEvent(doTests);
    1.73 +  </script>
    1.74 +
    1.75 +  <hbox flex="1" style="overflow: auto;">
    1.76 +    <body xmlns="http://www.w3.org/1999/xhtml">
    1.77 +      <a target="_blank"
    1.78 +         href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958"
    1.79 +         title="Rework accessible focus handling">
    1.80 +        Mozilla Bug 673958
    1.81 +      </a>
    1.82 +      <p id="display"></p>
    1.83 +      <div id="content" style="display: none"></div>
    1.84 +      <pre id="test">
    1.85 +      </pre>
    1.86 +    </body>
    1.87 +
    1.88 +    <vbox flex="1">
    1.89 +      <button id="button" context="contextmenu" label="button"/>
    1.90 +      <menupopup id="contextmenu">
    1.91 +        <menuitem id="item1" label="item1"/>
    1.92 +        <menu id="item2" label="item2">
    1.93 +          <menupopup>
    1.94 +            <menuitem id="item2.1" label="item2.1"/>
    1.95 +          </menupopup>
    1.96 +        </menu>
    1.97 +      </menupopup>
    1.98 +
    1.99 +      <vbox id="eventdump"/>
   1.100 +    </vbox>
   1.101 +  </hbox>
   1.102 +</window>

mercurial