accessible/tests/mochitest/states/test_stale.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>
     3 <head>
     4   <title>Stale state testing</title>
     5   <link rel="stylesheet" type="text/css"
     6         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     8   <script type="application/javascript"
     9           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    11   <script type="application/javascript"
    12           src="../common.js"></script>
    13   <script type="application/javascript"
    14           src="../role.js"></script>
    15   <script type="application/javascript"
    16           src="../states.js"></script>
    17   <script type="application/javascript"
    18           src="../events.js"></script>
    20   <script type="application/javascript">
    21     function addChild(aContainerID)
    22     {
    23       this.containerNode = getNode(aContainerID);
    24       this.childNode = null;
    26       this.eventSeq = [
    27         new invokerChecker(EVENT_REORDER, this.containerNode)
    28       ];
    30       this.invoke = function addChild_invoke()
    31       {
    32         this.childNode = document.createElement("div");
    33         this.containerNode.appendChild(this.childNode);
    34       }
    36       this.finalCheck = function addChild_finalCheck()
    37       {
    38         // no stale state should be set
    39         testStates(this.childNode, 0, 0, 0, EXT_STATE_STALE);
    40       }
    42       this.getID = function addChild_getID()
    43       {
    44         return "add child for " + prettyName(aContainerID);
    45       }
    46     }
    48     function removeChildChecker(aInvoker)
    49     {
    50       this.type = EVENT_HIDE;
    51       this.__defineGetter__("target", function() { return aInvoker.child; });
    53       this.check = function removeChildChecker_check()
    54       {
    55         // stale state should be set
    56         testStates(aInvoker.child, 0, EXT_STATE_STALE);
    57       }
    58     }
    60     function removeChild(aContainerID)
    61     {
    62       this.containerNode = getNode(aContainerID);
    63       this.child = null;
    65       this.eventSeq = [
    66         new removeChildChecker(this)
    67       ];
    69       this.invoke = function removeChild_invoke()
    70       {
    71         var childNode = this.containerNode.firstChild;
    72         this.child = getAccessible(childNode);
    74         this.containerNode.removeChild(childNode);
    75       }
    77       this.getID = function removeChild_getID()
    78       {
    79         return "remove child from " + prettyName(aContainerID);
    80       }
    81     }
    83     //gA11yEventDumpToConsole = true; //debugging
    85     var gQueue = null;
    86     function doTest()
    87     {
    88       gQueue = new eventQueue();
    90       gQueue.push(new addChild("container"));
    91       gQueue.push(new removeChild("container"));
    93       gQueue.invoke(); // will call SimpleTest.finish()
    94     }
    96     SimpleTest.waitForExplicitFinish();
    97     addA11yLoadEvent(doTest);
    98   </script>
    99 </head>
   101 <body role="">
   103   <a target="_blank"
   104      title="Expose stale state on accessibles unattached from tree"
   105      href="https://bugzilla.mozilla.org/show_bug.cgi?id=676267">Mozilla Bug 676267</a>
   107   <p id="display"></p>
   108   <div id="content" style="display: none"></div>
   109   <pre id="test">
   110   </pre>
   112   <div id="container"></div>
   114 </body>
   115 </html>

mercurial