accessible/tests/mochitest/focus/test_takeFocus.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/focus/test_takeFocus.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,128 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>nsIAccessible::takeFocus testing</title>
     1.8 +
     1.9 +  <link rel="stylesheet" type="text/css"
    1.10 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +
    1.15 +  <script type="application/javascript"
    1.16 +          src="../common.js"></script>
    1.17 +  <script type="application/javascript"
    1.18 +          src="../role.js"></script>
    1.19 +  <script type="application/javascript"
    1.20 +          src="../states.js"></script>
    1.21 +  <script type="application/javascript"
    1.22 +          src="../events.js"></script>
    1.23 +
    1.24 +  <script type="application/javascript">
    1.25 +    ////////////////////////////////////////////////////////////////////////////
    1.26 +    // Invokers
    1.27 +
    1.28 +    function takeFocusInvoker(aID)
    1.29 +    {
    1.30 +      this.accessible = getAccessible(aID);
    1.31 +
    1.32 +      this.eventSeq = [ new focusChecker(this.accessible) ];
    1.33 +
    1.34 +      this.invoke = function takeFocusInvoker_invoke()
    1.35 +      {
    1.36 +        this.accessible.takeFocus();
    1.37 +      }
    1.38 +
    1.39 +      this.getID = function takeFocusInvoker_getID()
    1.40 +      {
    1.41 +        return "takeFocus for " + prettyName(aID);
    1.42 +      }
    1.43 +    }
    1.44 +
    1.45 +    ////////////////////////////////////////////////////////////////////////////
    1.46 +    // Test
    1.47 +
    1.48 +    //gA11yEventDumpToConsole = true; // debug stuff
    1.49 +
    1.50 +    var gQueue = null;
    1.51 +    function doTest()
    1.52 +    {
    1.53 +      disableLogging(); // from test_focusedChild
    1.54 +      gQueue = new eventQueue();
    1.55 +
    1.56 +      gQueue.push(new takeFocusInvoker("aria-link"));
    1.57 +      gQueue.push(new takeFocusInvoker("aria-link2"));
    1.58 +      gQueue.push(new takeFocusInvoker("link"));
    1.59 +      gQueue.push(new takeFocusInvoker("item2"));
    1.60 +      gQueue.push(new takeFocusInvoker("plugin"));
    1.61 +      gQueue.push(new takeFocusInvoker(document));
    1.62 +      gQueue.push(new takeFocusInvoker("lb_item2"));
    1.63 +      gQueue.push(new takeFocusInvoker(document));
    1.64 +      gQueue.push(new takeFocusInvoker("lb_item3.2"));
    1.65 +      gQueue.push(new takeFocusInvoker(document));
    1.66 +      gQueue.push(new takeFocusInvoker("lb_item3.1"));
    1.67 +
    1.68 +      gQueue.invoke(); // Will call SimpleTest.finish();
    1.69 +    }
    1.70 +
    1.71 +    function waitForPlugin()
    1.72 +    {
    1.73 +      window.setTimeout((isAccessible("plugin") ? doTest : waitForPlugin), 0);
    1.74 +    }
    1.75 +
    1.76 +    SimpleTest.waitForExplicitFinish();
    1.77 +    setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
    1.78 +    addA11yLoadEvent(waitForPlugin);
    1.79 +  </script>
    1.80 +</head>
    1.81 +
    1.82 +<body>
    1.83 +
    1.84 +  <a target="_blank"
    1.85 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547"
    1.86 +     title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()">
    1.87 +    Mozilla Bug 429547
    1.88 +  </a>
    1.89 +  <a target="_blank"
    1.90 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=452710"
    1.91 +     title="nsIAccessible::takeFocus testing">
    1.92 +    Mozilla Bug 452710
    1.93 +  </a>
    1.94 +  <a target="_blank"
    1.95 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=646361"
    1.96 +     title="No focus event fired on document when focus is set to the document while focused in a plugin">
    1.97 +    Mozilla Bug 646361
    1.98 +  </a>
    1.99 +  <a target="_blank"
   1.100 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=706067"
   1.101 +     title="Make takeFocus work on widget items">
   1.102 +    Mozilla Bug 706067
   1.103 +  </a>
   1.104 +  <p id="display"></p>
   1.105 +  <div id="content" style="display: none"></div>
   1.106 +  <pre id="test">
   1.107 +  </pre>
   1.108 +
   1.109 +  <span id="aria-link" role="link" tabindex="0">link</span>
   1.110 +  <span id="aria-link2" role="link" tabindex="0">link</span>
   1.111 +
   1.112 +  <a id="link" href="">link</a>
   1.113 +
   1.114 +  <div role="listbox" aria-activedescendant="item1" id="container" tabindex="1">
   1.115 +    <div role="option" id="item1">item1</div>
   1.116 +    <div role="option" id="item2">item2</div>
   1.117 +    <div role="option" id="item3">item3</div>
   1.118 +  </div>
   1.119 +
   1.120 +  <embed id="plugin" type="application/x-test" width="200" height="200" wmode="window"></embed>
   1.121 +
   1.122 +  <select id="listbox" size="5">
   1.123 +    <option id="lb_item1">item1</option>
   1.124 +    <option id="lb_item2">item2</option>
   1.125 +    <optgroup>
   1.126 +      <option id="lb_item3.1">item 3.1</option>
   1.127 +      <option id="lb_item3.2">item 3.2</option>
   1.128 +    </optgroup>
   1.129 +  </select>
   1.130 +</body>
   1.131 +</html>

mercurial