accessible/tests/mochitest/focus/test_takeFocus.html
author David Anderson <danderson@mozilla.com>
Wed, 05 Oct 2011 19:52:55 -0700
changeset 111527 8cfeba5239a9e4f20c462d6fb20421b4e4e7c735
parent 111524 cad26d2fb5af799dfe030fd2a8948d617eac2f52
child 111709 f159717b4e7d3ff94b59e7c7e1ba920c578118a8
permissions -rw-r--r--
Merge to eliminate bad head.

<html>

<head>
  <title>nsIAccessible::takeFocus testing</title>

  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../states.js"></script>
  <script type="application/javascript"
          src="../events.js"></script>

  <script type="application/javascript">
    ////////////////////////////////////////////////////////////////////////////
    // Test

    var gQueue = null;

    function takeFocusInvoker(aID)
    {
      this.accessible = getAccessible(aID);

      this.eventSeq = [ new focusChecker(this.accessible) ];

      this.invoke = function takeFocusInvoker_invoke()
      {
        this.accessible.takeFocus();
      }

      this.getID = function takeFocusInvoker_getID()
      {
        return "takeFocus for " + prettyName(aID);
      }
    }

    function doTest()
    {
      gQueue = new eventQueue();

      gQueue.push(new takeFocusInvoker("aria-link"));
      gQueue.push(new takeFocusInvoker("aria-link2"));
      gQueue.push(new takeFocusInvoker("link"));
      gQueue.push(new takeFocusInvoker("item2"));
      gQueue.push(new takeFocusInvoker("plugin"));
      gQueue.push(new takeFocusInvoker(document));

      gQueue.invoke(); // Will call SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>

<body>

  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547"
     title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()">
    Mozilla Bug 429547
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=452710"
     title="nsIAccessible::takeFocus testing">
    Mozilla Bug 452710
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=646361"
     title="No focus event fired on document when focus is set to the document while focused in a plugin">
    Mozilla Bug 646361
  </a>
  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <span id="aria-link" role="link" tabindex="0">link</span>
  <span id="aria-link2" role="link" tabindex="0">link</span>

  <a id="link" href="">link</span>

  <div role="listbox" aria-activedescendant="item1" id="container" tabindex="1">
    <div role="listitem" id="item1">item1</div>
    <div role="listitem" id="item2">item2</div>
    <div role="listitem" id="item3">item3</div>
  </div>

  <embed id="plugin" type="application/x-test" width="200" height="200" wmode="window"></embed>
</body>
</html>