accessible/tests/mochitest/treeupdate/test_hidden.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/treeupdate/test_hidden.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,135 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +
     1.7 +<head>
     1.8 +  <title>@hidden attribute testing</title>
     1.9 +
    1.10 +  <link rel="stylesheet" type="text/css"
    1.11 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.12 +
    1.13 +  <script type="application/javascript"
    1.14 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.15 +
    1.16 +  <script type="application/javascript"
    1.17 +          src="../common.js"></script>
    1.18 +  <script type="application/javascript"
    1.19 +          src="../role.js"></script>
    1.20 +  <script type="application/javascript"
    1.21 +          src="../events.js"></script>
    1.22 +
    1.23 +  <script type="application/javascript">
    1.24 +
    1.25 +    ////////////////////////////////////////////////////////////////////////////
    1.26 +    // Invokers
    1.27 +    ////////////////////////////////////////////////////////////////////////////
    1.28 +
    1.29 +    /**
    1.30 +     * Set @hidden attribute
    1.31 +     */
    1.32 +    function setHiddenAttr(aContainerID, aChildID)
    1.33 +    {
    1.34 +      this.eventSeq = [
    1.35 +        new invokerChecker(EVENT_REORDER, getNode(aContainerID))
    1.36 +      ];
    1.37 +
    1.38 +      this.invoke = function setHiddenAttr_invoke()
    1.39 +      {
    1.40 +        var tree =
    1.41 +          { SECTION: [
    1.42 +              { ENTRY: [
    1.43 +              ] }
    1.44 +          ] };
    1.45 +        testAccessibleTree(aContainerID, tree);
    1.46 +
    1.47 +        getNode(aChildID).setAttribute("hidden", "true");
    1.48 +      }
    1.49 +
    1.50 +      this.finalCheck = function setHiddenAttr_finalCheck()
    1.51 +      {
    1.52 +        var tree =
    1.53 +          { SECTION: [
    1.54 +          ] };
    1.55 +        testAccessibleTree(aContainerID, tree);
    1.56 +      }
    1.57 +
    1.58 +      this.getID = function setHiddenAttr_getID()
    1.59 +      {
    1.60 +        return "Set @hidden attribute on input and test accessible tree for div";
    1.61 +      }
    1.62 +    }
    1.63 +
    1.64 +    /**
    1.65 +     * Remove @hidden attribute
    1.66 +     */
    1.67 +    function removeHiddenAttr(aContainerID, aChildID)
    1.68 +    {
    1.69 +      this.eventSeq = [
    1.70 +        new invokerChecker(EVENT_REORDER, getNode(aContainerID))
    1.71 +      ];
    1.72 +
    1.73 +      this.invoke = function removeHiddenAttr_invoke()
    1.74 +      {
    1.75 +        var tree =
    1.76 +          { SECTION: [
    1.77 +          ] };
    1.78 +        testAccessibleTree(aContainerID, tree);
    1.79 +
    1.80 +        getNode(aChildID).removeAttribute("hidden");
    1.81 +      }
    1.82 +
    1.83 +      this.finalCheck = function removeHiddenAttr_finalCheck()
    1.84 +      {
    1.85 +        var tree =
    1.86 +          { SECTION: [
    1.87 +              { ENTRY: [
    1.88 +              ] }
    1.89 +          ] };
    1.90 +        testAccessibleTree(aContainerID, tree);
    1.91 +      }
    1.92 +
    1.93 +      this.getID = function removeHiddenAttr_getID()
    1.94 +      {
    1.95 +        return "Remove @hidden attribute on input and test accessible tree for div";
    1.96 +      }
    1.97 +    }
    1.98 +
    1.99 +    ////////////////////////////////////////////////////////////////////////////
   1.100 +    // Test
   1.101 +    ////////////////////////////////////////////////////////////////////////////
   1.102 +
   1.103 +    //gA11yEventDumpID = "eventdump"; // debug stuff
   1.104 +    //gA11yEventDumpToConsole = true;
   1.105 +
   1.106 +    var gQueue = null;
   1.107 +
   1.108 +    function doTest()
   1.109 +    {
   1.110 +      gQueue = new eventQueue();
   1.111 +
   1.112 +      gQueue.push(new setHiddenAttr("container", "child"));
   1.113 +      gQueue.push(new removeHiddenAttr("container", "child"));
   1.114 +
   1.115 +      gQueue.invoke(); // SimpleTest.finish() will be called in the end
   1.116 +    }
   1.117 +
   1.118 +    SimpleTest.waitForExplicitFinish();
   1.119 +    addA11yLoadEvent(doTest);
   1.120 +
   1.121 +  </script>
   1.122 +
   1.123 +</head>
   1.124 +
   1.125 +<body>
   1.126 +
   1.127 +  <p id="display"></p>
   1.128 +  <div id="content" style="display: none"></div>
   1.129 +  <pre id="test">
   1.130 +  </pre>
   1.131 +
   1.132 +  <div id="container"><input id="child"></div>
   1.133 +
   1.134 +  <div id="eventdump"></div>
   1.135 +
   1.136 +</body>
   1.137 +
   1.138 +</html>

mercurial