bug 462314 - Refactor test_aria_activedescendant.html, r=surkov
authorMarco Zehe <marco.zehe@googlemail.com>
Thu, 30 Oct 2008 11:39:17 +0100
changeset 21095 1ac20b494c0f8e5a133919160130165450bcceca
parent 21094 c462ee9c7d4580011eed3a1ac939c4a00a271e42
child 21096 443f9092eba5a61071bf072aad7b044c5f8c42f6
push id3307
push usermzehe@mozilla.com
push dateThu, 30 Oct 2008 10:39:42 +0000
treeherdermozilla-central@1ac20b494c0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs462314
milestone1.9.1b2pre
bug 462314 - Refactor test_aria_activedescendant.html, r=surkov
accessible/tests/mochitest/test_aria_activedescendant.html
--- a/accessible/tests/mochitest/test_aria_activedescendant.html
+++ b/accessible/tests/mochitest/test_aria_activedescendant.html
@@ -1,76 +1,72 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=429547
--->
-<head>
-  <title>Table indexes chrome tests</title>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-
-  <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
-  <script type="application/javascript">
-    const nsIAccessibleRetrieval = Components.interfaces.nsIAccessibleRetrieval;
-    const ELEMENT_NODE = Components.interfaces.nsIDOMNode.ELEMENT_NODE;
-
-    var gAccRetrieval = null;
-    var gContainerFocused = false;
-
-    function doTest()
-    {
-      var focusHandler = {
-        handleEvent: function handleEvent(aEvent) {
-          var target = aEvent.target;
-          if (target.nodeType ==  ELEMENT_NODE &&
-              target.getAttribute("id") == "container")
-            gContainerFocused = true;
-        }
-      };
-
-      var container = document.getElementById("container");
-      container.addEventListener("focus", focusHandler, false);
-
-      gAccRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
-                      getService(nsIAccessibleRetrieval);
-
-      var item2 = document.getElementById("item2");
-      var item2Acc = null;
-      try {
-        item2Acc = gAccRetrieval.getAccessibleFor(item2);
-      } catch (e) {}
-      ok (item2Acc,
-          "The element with ID and an ancestor with 'aria-activedescedant' attribute should be accessible.");
-
-      if (item2Acc)
-        item2Acc.takeFocus();
-
-      ok(gContainerFocused,
-         "Container with active descedant didn't recieved the focus.");
-
-      SimpleTest.finish();
-    }
-
-    SimpleTest.waitForExplicitFinish();
-    addLoadEvent(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>
-  <p id="display"></p>
-  <div id="content" style="display: none"></div>
-  <pre id="test">
-  </pre>
-
-  <div aria-activedescendant="item1" id="container" tabindex="1">
-    <div id="item1">item1</div>
-    <div id="item2">item2</div>
-    <div id="item3">item3</div>
-  </div>
-</body>
-</html>
+<!DOCTYPE html>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=429547
+-->
+<head>
+  <title>aria-activedescendant property chrome tests</title>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/MochiKit/packed.js"></script>
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/a11y/accessible/common.js"></script>
+
+  <script type="application/javascript">
+    const ELEMENT_NODE = nsIDOMNode.ELEMENT_NODE;
+
+    var gContainerFocused = false;
+
+    function doTest()
+    {
+      var focusHandler = {
+        handleEvent: function handleEvent(aEvent) {
+          var target = aEvent.target;
+          if (target.nodeType ==  ELEMENT_NODE &&
+              target.getAttribute("id") == "container")
+            gContainerFocused = true;
+        }
+      };
+
+      var container = document.getElementById("container");
+      container.addEventListener("focus", focusHandler, false);
+
+      var item2Acc = getAccessible("item2");
+      if (item2Acc) {
+        item2Acc.takeFocus();
+  
+        ok(gContainerFocused,
+           "Container with active descendant didn't receive the focus.");
+      }
+
+      container.removeEventListener("focus", focusHandler, false);
+
+      SimpleTest.finish();
+    }
+
+    SimpleTest.waitForExplicitFinish();
+    addLoadEvent(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>
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+  <div aria-activedescendant="item1" id="container" tabindex="1">
+    <div id="item1">item1</div>
+    <div id="item2">item2</div>
+    <div id="item3">item3</div>
+  </div>
+</body>
+</html>