|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 |
|
4 <head> |
|
5 <title>Test HTML li and listitem bullet accessible cache</title> |
|
6 <link rel="stylesheet" type="text/css" |
|
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../common.js"></script> |
|
14 <script type="application/javascript" |
|
15 src="../role.js"></script> |
|
16 <script type="application/javascript" |
|
17 src="../events.js"></script> |
|
18 |
|
19 <script type="application/javascript"> |
|
20 |
|
21 //////////////////////////////////////////////////////////////////////////// |
|
22 // Helpers |
|
23 |
|
24 function testLiAccessibleTree() |
|
25 { |
|
26 // Test accessible tree. |
|
27 var accTree = { |
|
28 role: ROLE_LISTITEM, |
|
29 children: [ |
|
30 { |
|
31 role: ROLE_STATICTEXT, |
|
32 children: [] |
|
33 }, |
|
34 { |
|
35 role: ROLE_TEXT_LEAF, |
|
36 children: [] |
|
37 } |
|
38 ] |
|
39 }; |
|
40 |
|
41 testAccessibleTree("li", accTree); |
|
42 } |
|
43 |
|
44 //////////////////////////////////////////////////////////////////////////// |
|
45 // Sequence item processors |
|
46 |
|
47 function hideProcessor() |
|
48 { |
|
49 this.liNode = getNode("li"); |
|
50 this.li = getAccessible(this.liNode); |
|
51 this.bullet = this.li.firstChild; |
|
52 |
|
53 this.process = function hideProcessor_process() |
|
54 { |
|
55 this.liNode.style.display = "none"; |
|
56 } |
|
57 |
|
58 this.onProcessed = function hideProcessor_onProcessed() |
|
59 { |
|
60 window.setTimeout( |
|
61 function(aLiAcc, aLiNode, aBulletAcc) |
|
62 { |
|
63 testDefunctAccessible(aLiAcc, aLiNode); |
|
64 testDefunctAccessible(aBulletAcc); |
|
65 |
|
66 gSequence.processNext(); |
|
67 }, |
|
68 0, this.li, this.liNode, this.bullet |
|
69 ); |
|
70 } |
|
71 }; |
|
72 |
|
73 function showProcessor() |
|
74 { |
|
75 this.liNode = getNode("li"); |
|
76 |
|
77 this.process = function showProcessor_process() |
|
78 { |
|
79 this.liNode.style.display = "list-item"; |
|
80 } |
|
81 |
|
82 this.onProcessed = function showProcessor_onProcessed() |
|
83 { |
|
84 testLiAccessibleTree(); |
|
85 SimpleTest.finish(); |
|
86 } |
|
87 }; |
|
88 |
|
89 //////////////////////////////////////////////////////////////////////////// |
|
90 // Test |
|
91 |
|
92 var gSequence = null; |
|
93 |
|
94 function doTest() |
|
95 { |
|
96 testLiAccessibleTree(); |
|
97 |
|
98 gSequence = new sequence(); |
|
99 |
|
100 gSequence.append(new hideProcessor(), EVENT_HIDE, getAccessible("li"), |
|
101 "hide HTML li"); |
|
102 gSequence.append(new showProcessor(), EVENT_SHOW, getNode("li"), |
|
103 "show HTML li"); |
|
104 |
|
105 gSequence.processNext(); // SimpleTest.finish() will be called in the end |
|
106 } |
|
107 |
|
108 SimpleTest.waitForExplicitFinish(); |
|
109 addA11yLoadEvent(doTest); |
|
110 </script> |
|
111 </head> |
|
112 <body> |
|
113 |
|
114 <a target="_blank" |
|
115 title="setParent shouldn't be virtual" |
|
116 href="https://bugzilla.mozilla.org/show_bug.cgi?id=496783">Mozilla Bug 496783</a> |
|
117 |
|
118 <p id="display"></p> |
|
119 <div id="content" style="display: none"></div> |
|
120 <pre id="test"> |
|
121 </pre> |
|
122 |
|
123 <ul> |
|
124 <li id="li">item1</li> |
|
125 </ul> |
|
126 </body> |
|
127 </html> |