|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
|
4 type="text/css"?> |
|
5 |
|
6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
7 title="Accessible XUL button hierarchy tests"> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" /> |
|
13 |
|
14 <script type="application/javascript" |
|
15 src="../common.js" /> |
|
16 <script type="application/javascript" |
|
17 src="../role.js" /> |
|
18 <script type="application/javascript" |
|
19 src="../events.js" /> |
|
20 |
|
21 <script type="application/javascript"> |
|
22 <![CDATA[ |
|
23 |
|
24 //////////////////////////////////////////////////////////////////////////// |
|
25 // Invokers |
|
26 |
|
27 function openMenu(aButtonID, aMenuItemRole) |
|
28 { |
|
29 var menuItemRole = aMenuItemRole || ROLE_MENUITEM; |
|
30 this.button = getAccessible(aButtonID); |
|
31 this.menupopup = this.button.firstChild; |
|
32 |
|
33 var checker = new invokerChecker(EVENT_REORDER, this.menupopup); |
|
34 this.__proto__ = new synthClick(aButtonID, checker); |
|
35 |
|
36 this.invoke = function openMenu_invoke() |
|
37 { |
|
38 var tree = |
|
39 { PUSHBUTTON: [ |
|
40 { MENUPOPUP: [ ] } |
|
41 ] }; |
|
42 testAccessibleTree(this.button, tree); |
|
43 |
|
44 this.__proto__.invoke(); |
|
45 } |
|
46 |
|
47 this.finalCheck = function openMenu_finalCheck() |
|
48 { |
|
49 var tree = |
|
50 { PUSHBUTTON: [ |
|
51 { MENUPOPUP: [ |
|
52 { role: menuItemRole, children: [ ] }, |
|
53 { role: menuItemRole, children: [ ] } |
|
54 ] } |
|
55 ] }; |
|
56 testAccessibleTree(this.button, tree); |
|
57 |
|
58 synthesizeKey("VK_ESCAPE", { }); |
|
59 } |
|
60 |
|
61 this.getID = function openMenu_getID() |
|
62 { |
|
63 return "open menu of the button " + prettyName(aButtonID); |
|
64 } |
|
65 } |
|
66 |
|
67 function openMenuButton(aButtonID) |
|
68 { |
|
69 this.buttonNode = getNode(aButtonID); |
|
70 this.menupoupNode = this.buttonNode.firstChild; |
|
71 |
|
72 this.eventSeq = [ |
|
73 new invokerChecker(EVENT_REORDER, this.menupoupNode) |
|
74 ]; |
|
75 |
|
76 this.invoke = function openMenu_invoke() |
|
77 { |
|
78 var tree = |
|
79 { PUSHBUTTON: [ |
|
80 { MENUPOPUP: [ ] }, |
|
81 { PUSHBUTTON: [ ] } |
|
82 ] }; |
|
83 testAccessibleTree(this.buttonNode, tree); |
|
84 |
|
85 this.buttonNode.open = true; |
|
86 } |
|
87 |
|
88 this.finalCheck = function openMenu_finalCheck() |
|
89 { |
|
90 var tree = |
|
91 { PUSHBUTTON: [ |
|
92 { MENUPOPUP: [ |
|
93 { MENUITEM: [ ] }, |
|
94 { MENUITEM: [ ] } |
|
95 ] }, |
|
96 { PUSHBUTTON: [ ] } |
|
97 ] }; |
|
98 testAccessibleTree(this.buttonNode, tree); |
|
99 |
|
100 this.buttonNode.open = false; |
|
101 } |
|
102 |
|
103 this.getID = function openMenu_getID() |
|
104 { |
|
105 return "open menu for menu button " + prettyName(aButtonID); |
|
106 } |
|
107 } |
|
108 |
|
109 //////////////////////////////////////////////////////////////////////////// |
|
110 // Do test |
|
111 |
|
112 gA11yEventDumpToConsole = true; // debug stuff |
|
113 |
|
114 var gQueue = null; |
|
115 |
|
116 function doTest() |
|
117 { |
|
118 gQueue = new eventQueue(); |
|
119 |
|
120 gQueue.push(new openMenu("button1")); |
|
121 gQueue.push(new openMenuButton("button2")); |
|
122 gQueue.push(new openMenu("button3")); |
|
123 gQueue.push(new openMenuButton("button4")); |
|
124 |
|
125 var columnPickerBtn = getAccessible("tree").firstChild.lastChild; |
|
126 gQueue.push(new openMenu(columnPickerBtn, ROLE_CHECK_MENU_ITEM)); |
|
127 gQueue.invoke(); // SimpleTest.finish() |
|
128 } |
|
129 |
|
130 SimpleTest.waitForExplicitFinish(); |
|
131 addA11yLoadEvent(doTest); |
|
132 ]]> |
|
133 </script> |
|
134 |
|
135 <hbox flex="1" style="overflow: auto;"> |
|
136 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
137 <a target="_blank" |
|
138 href="https://bugzilla.mozilla.org/show_bug.cgi?id=249292" |
|
139 title="Ensure accessible children for toolbarbutton types 'menu' and 'menu-button'"> |
|
140 Bug 249292 |
|
141 </a> |
|
142 <a target="_blank" |
|
143 href="https://bugzilla.mozilla.org/show_bug.cgi?id=630486" |
|
144 title="Don't force accessible creation for popup children"> |
|
145 Bug 630486 |
|
146 </a> |
|
147 <a target="_blank" |
|
148 href="https://bugzilla.mozilla.org/show_bug.cgi?id=722265" |
|
149 title="Column header selection popup no longer exposed to accessibility APIs"> |
|
150 Bug 722265 |
|
151 </a> |
|
152 <br/> |
|
153 <p id="display"></p> |
|
154 <div id="content" style="display: none"> |
|
155 </div> |
|
156 <pre id="test"> |
|
157 </pre> |
|
158 </body> |
|
159 |
|
160 <vbox flex="1"> |
|
161 <button id="button1" type="menu" label="button"> |
|
162 <menupopup> |
|
163 <menuitem label="menuitem"/> |
|
164 <menuitem label="menuitem"/> |
|
165 </menupopup> |
|
166 </button> |
|
167 <button id="button2" type="menu-button" label="menu button"> |
|
168 <menupopup> |
|
169 <menuitem label="menuitem"/> |
|
170 <menuitem label="menuitem"/> |
|
171 </menupopup> |
|
172 </button> |
|
173 |
|
174 <toolbarbutton id="button3" type="menu" label="toolbarbutton"> |
|
175 <menupopup> |
|
176 <menuitem label="menuitem"/> |
|
177 <menuitem label="menuitem"/> |
|
178 </menupopup> |
|
179 </toolbarbutton> |
|
180 <toolbarbutton id="button4" type="menu-button" label="menu toolbarbutton"> |
|
181 <menupopup> |
|
182 <menuitem label="menuitem"/> |
|
183 <menuitem label="menuitem"/> |
|
184 </menupopup> |
|
185 </toolbarbutton> |
|
186 |
|
187 <tree id="tree" flex="1"> |
|
188 <treecols> |
|
189 <treecol id="col" flex="1" primary="true" label="column"/> |
|
190 <treecol id="col2" flex="1" label="another column"/> |
|
191 </treecols> |
|
192 <treechildren/> |
|
193 </tree> |
|
194 </vbox> |
|
195 </hbox> |
|
196 |
|
197 </window> |
|
198 |