accessible/tests/mochitest/treeupdate/test_hidden.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!DOCTYPE html>
     2 <html>
     4 <head>
     5   <title>@hidden attribute testing</title>
     7   <link rel="stylesheet" type="text/css"
     8         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    10   <script type="application/javascript"
    11           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    13   <script type="application/javascript"
    14           src="../common.js"></script>
    15   <script type="application/javascript"
    16           src="../role.js"></script>
    17   <script type="application/javascript"
    18           src="../events.js"></script>
    20   <script type="application/javascript">
    22     ////////////////////////////////////////////////////////////////////////////
    23     // Invokers
    24     ////////////////////////////////////////////////////////////////////////////
    26     /**
    27      * Set @hidden attribute
    28      */
    29     function setHiddenAttr(aContainerID, aChildID)
    30     {
    31       this.eventSeq = [
    32         new invokerChecker(EVENT_REORDER, getNode(aContainerID))
    33       ];
    35       this.invoke = function setHiddenAttr_invoke()
    36       {
    37         var tree =
    38           { SECTION: [
    39               { ENTRY: [
    40               ] }
    41           ] };
    42         testAccessibleTree(aContainerID, tree);
    44         getNode(aChildID).setAttribute("hidden", "true");
    45       }
    47       this.finalCheck = function setHiddenAttr_finalCheck()
    48       {
    49         var tree =
    50           { SECTION: [
    51           ] };
    52         testAccessibleTree(aContainerID, tree);
    53       }
    55       this.getID = function setHiddenAttr_getID()
    56       {
    57         return "Set @hidden attribute on input and test accessible tree for div";
    58       }
    59     }
    61     /**
    62      * Remove @hidden attribute
    63      */
    64     function removeHiddenAttr(aContainerID, aChildID)
    65     {
    66       this.eventSeq = [
    67         new invokerChecker(EVENT_REORDER, getNode(aContainerID))
    68       ];
    70       this.invoke = function removeHiddenAttr_invoke()
    71       {
    72         var tree =
    73           { SECTION: [
    74           ] };
    75         testAccessibleTree(aContainerID, tree);
    77         getNode(aChildID).removeAttribute("hidden");
    78       }
    80       this.finalCheck = function removeHiddenAttr_finalCheck()
    81       {
    82         var tree =
    83           { SECTION: [
    84               { ENTRY: [
    85               ] }
    86           ] };
    87         testAccessibleTree(aContainerID, tree);
    88       }
    90       this.getID = function removeHiddenAttr_getID()
    91       {
    92         return "Remove @hidden attribute on input and test accessible tree for div";
    93       }
    94     }
    96     ////////////////////////////////////////////////////////////////////////////
    97     // Test
    98     ////////////////////////////////////////////////////////////////////////////
   100     //gA11yEventDumpID = "eventdump"; // debug stuff
   101     //gA11yEventDumpToConsole = true;
   103     var gQueue = null;
   105     function doTest()
   106     {
   107       gQueue = new eventQueue();
   109       gQueue.push(new setHiddenAttr("container", "child"));
   110       gQueue.push(new removeHiddenAttr("container", "child"));
   112       gQueue.invoke(); // SimpleTest.finish() will be called in the end
   113     }
   115     SimpleTest.waitForExplicitFinish();
   116     addA11yLoadEvent(doTest);
   118   </script>
   120 </head>
   122 <body>
   124   <p id="display"></p>
   125   <div id="content" style="display: none"></div>
   126   <pre id="test">
   127   </pre>
   129   <div id="container"><input id="child"></div>
   131   <div id="eventdump"></div>
   133 </body>
   135 </html>

mercurial