accessible/tests/mochitest/states/test_stale.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial