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