|
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 input control state tests"> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../common.js" /> |
|
14 <script type="application/javascript" |
|
15 src="../role.js" /> |
|
16 <script type="application/javascript" |
|
17 src="../states.js" /> |
|
18 <script type="application/javascript" |
|
19 src="../events.js" /> |
|
20 |
|
21 <script type="application/javascript"> |
|
22 <![CDATA[ |
|
23 function openColorpicker(aID) |
|
24 { |
|
25 this.popupNode = getNode(aID).mPicker.parentNode; |
|
26 this.popup = getAccessible(this.popupNode); |
|
27 |
|
28 this.eventSeq = [ |
|
29 new invokerChecker(EVENT_REORDER, this.popupNode) |
|
30 ]; |
|
31 |
|
32 this.invoke = function openColorpicker_invoke() |
|
33 { |
|
34 getNode(aID).showPopup(); |
|
35 } |
|
36 |
|
37 this.finalCheck = function openColorpicker_finalCheck() |
|
38 { |
|
39 testStates(this.popup.firstChild, |
|
40 STATE_FOCUSABLE | STATE_SELECTABLE, 0, |
|
41 STATE_UNAVAILABLE); |
|
42 } |
|
43 |
|
44 this.getID = function openColorpicker_getID() |
|
45 { |
|
46 return "open colorpicker"; |
|
47 } |
|
48 } |
|
49 |
|
50 var gQueue = null; |
|
51 function doTest() |
|
52 { |
|
53 testStates("checkbox", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); |
|
54 testStates("checkbox2", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); |
|
55 testStates("radiogroup", 0, 0, STATE_FOCUSABLE | STATE_UNAVAILABLE); |
|
56 testStates("radio", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); |
|
57 testStates("radio-disabled", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); |
|
58 testStates("radiogroup-disabled", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); |
|
59 testStates("radio-disabledradiogroup", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); |
|
60 testStates("button", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); |
|
61 testStates("button-disabled", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); |
|
62 testStates("colorpicker", STATE_FOCUSABLE | STATE_HASPOPUP, 0, STATE_UNAVAILABLE); |
|
63 testStates("colorpicker-disabled", STATE_HASPOPUP, 0, STATE_FOCUSABLE); |
|
64 testStates("combobox", STATE_FOCUSABLE | STATE_HASPOPUP, 0, STATE_UNAVAILABLE); |
|
65 testStates("combobox-disabled", STATE_UNAVAILABLE | STATE_HASPOPUP, 0, STATE_FOCUSABLE); |
|
66 testStates("listbox", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); |
|
67 testStates("listitem", STATE_FOCUSABLE | STATE_SELECTABLE, 0, STATE_UNAVAILABLE); |
|
68 testStates("listbox-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE); |
|
69 testStates("listitem-disabledlistbox", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE); |
|
70 testStates("menubar", 0, 0, STATE_FOCUSABLE); |
|
71 testStates("menu", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); |
|
72 testStates("menu-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE); |
|
73 testStates("scale", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); |
|
74 testStates("scale-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE); |
|
75 testStates("tab", STATE_FOCUSABLE | STATE_SELECTABLE | STATE_SELECTED, 0, STATE_UNAVAILABLE); |
|
76 testStates("tab-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE | STATE_SELECTED); |
|
77 |
|
78 gQueue = new eventQueue(); |
|
79 gQueue.push(new openColorpicker("colorpicker")); |
|
80 gQueue.invoke(); // Will call SimpleTest.finish() |
|
81 } |
|
82 |
|
83 SimpleTest.waitForExplicitFinish(); |
|
84 addA11yLoadEvent(doTest); |
|
85 ]]> |
|
86 </script> |
|
87 |
|
88 <hbox flex="1" style="overflow: auto;"> |
|
89 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
90 <a target="_blank" |
|
91 href="https://bugzilla.mozilla.org/show_bug.cgi?id=599163" |
|
92 title="check disabled state instead of attribute"> |
|
93 Mozilla Bug 599163 |
|
94 </a> |
|
95 <a target="_blank" |
|
96 href="https://bugzilla.mozilla.org/show_bug.cgi?id=756983" |
|
97 title="Isolate focusable and unavailable states from State()"> |
|
98 Mozilla Bug 756983 |
|
99 </a> |
|
100 <p id="display"></p> |
|
101 <div id="content" style="display: none"> |
|
102 </div> |
|
103 <pre id="test"> |
|
104 </pre> |
|
105 </body> |
|
106 |
|
107 <vbox flex="1"> |
|
108 |
|
109 <checkbox id="checkbox" checked="true" label="Steak"/> |
|
110 <checkbox id="checkbox2" checked="true" label="Salad" disabled="true"/> |
|
111 |
|
112 <radiogroup id="radiogroup"> |
|
113 <radio id="radio" label="Orange"/> |
|
114 <radio id="radio-disabled" selected="true" label="Violet" disabled="true"/> |
|
115 </radiogroup> |
|
116 |
|
117 <radiogroup id="radiogroup-disabled" disabled="true"> |
|
118 <radio id="radio-disabledradiogroup" label="Orange"/> |
|
119 <radio id="violet2" selected="true" label="Violet"/> |
|
120 </radiogroup> |
|
121 |
|
122 <button id="button" value="button"/> |
|
123 <button id="button-disabled" disabled="true" value="button"/> |
|
124 |
|
125 <colorpicker id="colorpicker" type="button"/> |
|
126 <colorpicker id="colorpicker-disabled" type="button" disabled="true"/> |
|
127 |
|
128 <menulist id="combobox"> |
|
129 <menupopup> |
|
130 <menuitem label="item1"/> |
|
131 </menupopup> |
|
132 </menulist> |
|
133 |
|
134 <menulist id="combobox-disabled" disabled="true"> |
|
135 <menupopup> |
|
136 <menuitem label="item1"/> |
|
137 </menupopup> |
|
138 </menulist> |
|
139 |
|
140 <listbox id="listbox"> |
|
141 <listitem id="listitem" label="list item"/> |
|
142 </listbox> |
|
143 |
|
144 <listbox id="listbox-disabled" disabled="true"> |
|
145 <listitem id="listitem-disabledlistbox" label="list item"/> |
|
146 </listbox> |
|
147 |
|
148 <toolbox> |
|
149 <menubar id="menubar"> |
|
150 <menu id="menu" label="menu1"> |
|
151 <menupopup> |
|
152 <menuitem id="menu1-item1" label="menuitem1.1"/> |
|
153 </menupopup> |
|
154 </menu> |
|
155 <menu id="menu-disabled" label="menu2" disabled="true"> |
|
156 <menupopup> |
|
157 <menuitem id="menu-disabled-item1" label="menuitem2.1"/> |
|
158 </menupopup> |
|
159 </menu> |
|
160 </menubar> |
|
161 </toolbox> |
|
162 |
|
163 <scale id="scale" min="1" max="10"/> |
|
164 <scale id="scale-disabled" min="1" max="10" disabled="true"/> |
|
165 |
|
166 <tabbox> |
|
167 <tabs> |
|
168 <tab id="tab" label="tab1" tooltip="tooltip"/> |
|
169 <tab id="tab-disabled" label="tab1" disabled="true"/> |
|
170 </tabs> |
|
171 <tabpanels> |
|
172 <tabpanel/> |
|
173 <tabpanel/> |
|
174 </tabpanels> |
|
175 </tabbox> |
|
176 |
|
177 <tooltip id="tooltip"><description>tooltip</description></tooltip> |
|
178 </vbox> |
|
179 </hbox> |
|
180 |
|
181 </window> |
|
182 |