accessible/tests/mochitest/states/test_stale.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:a1b11b076b9b
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" />
7
8 <script type="application/javascript"
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10
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>
19
20 <script type="application/javascript">
21 function addChild(aContainerID)
22 {
23 this.containerNode = getNode(aContainerID);
24 this.childNode = null;
25
26 this.eventSeq = [
27 new invokerChecker(EVENT_REORDER, this.containerNode)
28 ];
29
30 this.invoke = function addChild_invoke()
31 {
32 this.childNode = document.createElement("div");
33 this.containerNode.appendChild(this.childNode);
34 }
35
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 }
41
42 this.getID = function addChild_getID()
43 {
44 return "add child for " + prettyName(aContainerID);
45 }
46 }
47
48 function removeChildChecker(aInvoker)
49 {
50 this.type = EVENT_HIDE;
51 this.__defineGetter__("target", function() { return aInvoker.child; });
52
53 this.check = function removeChildChecker_check()
54 {
55 // stale state should be set
56 testStates(aInvoker.child, 0, EXT_STATE_STALE);
57 }
58 }
59
60 function removeChild(aContainerID)
61 {
62 this.containerNode = getNode(aContainerID);
63 this.child = null;
64
65 this.eventSeq = [
66 new removeChildChecker(this)
67 ];
68
69 this.invoke = function removeChild_invoke()
70 {
71 var childNode = this.containerNode.firstChild;
72 this.child = getAccessible(childNode);
73
74 this.containerNode.removeChild(childNode);
75 }
76
77 this.getID = function removeChild_getID()
78 {
79 return "remove child from " + prettyName(aContainerID);
80 }
81 }
82
83 //gA11yEventDumpToConsole = true; //debugging
84
85 var gQueue = null;
86 function doTest()
87 {
88 gQueue = new eventQueue();
89
90 gQueue.push(new addChild("container"));
91 gQueue.push(new removeChild("container"));
92
93 gQueue.invoke(); // will call SimpleTest.finish()
94 }
95
96 SimpleTest.waitForExplicitFinish();
97 addA11yLoadEvent(doTest);
98 </script>
99 </head>
100
101 <body role="">
102
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>
106
107 <p id="display"></p>
108 <div id="content" style="display: none"></div>
109 <pre id="test">
110 </pre>
111
112 <div id="container"></div>
113
114 </body>
115 </html>

mercurial