1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/states/test_controls.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,182 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.7 + type="text/css"?> 1.8 + 1.9 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.10 + title="Accessible XUL input control state tests"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + 1.15 + <script type="application/javascript" 1.16 + src="../common.js" /> 1.17 + <script type="application/javascript" 1.18 + src="../role.js" /> 1.19 + <script type="application/javascript" 1.20 + src="../states.js" /> 1.21 + <script type="application/javascript" 1.22 + src="../events.js" /> 1.23 + 1.24 + <script type="application/javascript"> 1.25 + <![CDATA[ 1.26 + function openColorpicker(aID) 1.27 + { 1.28 + this.popupNode = getNode(aID).mPicker.parentNode; 1.29 + this.popup = getAccessible(this.popupNode); 1.30 + 1.31 + this.eventSeq = [ 1.32 + new invokerChecker(EVENT_REORDER, this.popupNode) 1.33 + ]; 1.34 + 1.35 + this.invoke = function openColorpicker_invoke() 1.36 + { 1.37 + getNode(aID).showPopup(); 1.38 + } 1.39 + 1.40 + this.finalCheck = function openColorpicker_finalCheck() 1.41 + { 1.42 + testStates(this.popup.firstChild, 1.43 + STATE_FOCUSABLE | STATE_SELECTABLE, 0, 1.44 + STATE_UNAVAILABLE); 1.45 + } 1.46 + 1.47 + this.getID = function openColorpicker_getID() 1.48 + { 1.49 + return "open colorpicker"; 1.50 + } 1.51 + } 1.52 + 1.53 + var gQueue = null; 1.54 + function doTest() 1.55 + { 1.56 + testStates("checkbox", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); 1.57 + testStates("checkbox2", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); 1.58 + testStates("radiogroup", 0, 0, STATE_FOCUSABLE | STATE_UNAVAILABLE); 1.59 + testStates("radio", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); 1.60 + testStates("radio-disabled", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); 1.61 + testStates("radiogroup-disabled", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); 1.62 + testStates("radio-disabledradiogroup", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); 1.63 + testStates("button", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); 1.64 + testStates("button-disabled", STATE_UNAVAILABLE, 0 , STATE_FOCUSABLE); 1.65 + testStates("colorpicker", STATE_FOCUSABLE | STATE_HASPOPUP, 0, STATE_UNAVAILABLE); 1.66 + testStates("colorpicker-disabled", STATE_HASPOPUP, 0, STATE_FOCUSABLE); 1.67 + testStates("combobox", STATE_FOCUSABLE | STATE_HASPOPUP, 0, STATE_UNAVAILABLE); 1.68 + testStates("combobox-disabled", STATE_UNAVAILABLE | STATE_HASPOPUP, 0, STATE_FOCUSABLE); 1.69 + testStates("listbox", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); 1.70 + testStates("listitem", STATE_FOCUSABLE | STATE_SELECTABLE, 0, STATE_UNAVAILABLE); 1.71 + testStates("listbox-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE); 1.72 + testStates("listitem-disabledlistbox", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE); 1.73 + testStates("menubar", 0, 0, STATE_FOCUSABLE); 1.74 + testStates("menu", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); 1.75 + testStates("menu-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE); 1.76 + testStates("scale", STATE_FOCUSABLE, 0, STATE_UNAVAILABLE); 1.77 + testStates("scale-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE); 1.78 + testStates("tab", STATE_FOCUSABLE | STATE_SELECTABLE | STATE_SELECTED, 0, STATE_UNAVAILABLE); 1.79 + testStates("tab-disabled", STATE_UNAVAILABLE, 0, STATE_FOCUSABLE | STATE_SELECTABLE | STATE_SELECTED); 1.80 + 1.81 + gQueue = new eventQueue(); 1.82 + gQueue.push(new openColorpicker("colorpicker")); 1.83 + gQueue.invoke(); // Will call SimpleTest.finish() 1.84 + } 1.85 + 1.86 + SimpleTest.waitForExplicitFinish(); 1.87 + addA11yLoadEvent(doTest); 1.88 + ]]> 1.89 + </script> 1.90 + 1.91 + <hbox flex="1" style="overflow: auto;"> 1.92 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.93 + <a target="_blank" 1.94 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=599163" 1.95 + title="check disabled state instead of attribute"> 1.96 + Mozilla Bug 599163 1.97 + </a> 1.98 + <a target="_blank" 1.99 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=756983" 1.100 + title="Isolate focusable and unavailable states from State()"> 1.101 + Mozilla Bug 756983 1.102 + </a> 1.103 + <p id="display"></p> 1.104 + <div id="content" style="display: none"> 1.105 + </div> 1.106 + <pre id="test"> 1.107 + </pre> 1.108 + </body> 1.109 + 1.110 + <vbox flex="1"> 1.111 + 1.112 + <checkbox id="checkbox" checked="true" label="Steak"/> 1.113 + <checkbox id="checkbox2" checked="true" label="Salad" disabled="true"/> 1.114 + 1.115 + <radiogroup id="radiogroup"> 1.116 + <radio id="radio" label="Orange"/> 1.117 + <radio id="radio-disabled" selected="true" label="Violet" disabled="true"/> 1.118 + </radiogroup> 1.119 + 1.120 + <radiogroup id="radiogroup-disabled" disabled="true"> 1.121 + <radio id="radio-disabledradiogroup" label="Orange"/> 1.122 + <radio id="violet2" selected="true" label="Violet"/> 1.123 + </radiogroup> 1.124 + 1.125 + <button id="button" value="button"/> 1.126 + <button id="button-disabled" disabled="true" value="button"/> 1.127 + 1.128 + <colorpicker id="colorpicker" type="button"/> 1.129 + <colorpicker id="colorpicker-disabled" type="button" disabled="true"/> 1.130 + 1.131 + <menulist id="combobox"> 1.132 + <menupopup> 1.133 + <menuitem label="item1"/> 1.134 + </menupopup> 1.135 + </menulist> 1.136 + 1.137 + <menulist id="combobox-disabled" disabled="true"> 1.138 + <menupopup> 1.139 + <menuitem label="item1"/> 1.140 + </menupopup> 1.141 + </menulist> 1.142 + 1.143 + <listbox id="listbox"> 1.144 + <listitem id="listitem" label="list item"/> 1.145 + </listbox> 1.146 + 1.147 + <listbox id="listbox-disabled" disabled="true"> 1.148 + <listitem id="listitem-disabledlistbox" label="list item"/> 1.149 + </listbox> 1.150 + 1.151 + <toolbox> 1.152 + <menubar id="menubar"> 1.153 + <menu id="menu" label="menu1"> 1.154 + <menupopup> 1.155 + <menuitem id="menu1-item1" label="menuitem1.1"/> 1.156 + </menupopup> 1.157 + </menu> 1.158 + <menu id="menu-disabled" label="menu2" disabled="true"> 1.159 + <menupopup> 1.160 + <menuitem id="menu-disabled-item1" label="menuitem2.1"/> 1.161 + </menupopup> 1.162 + </menu> 1.163 + </menubar> 1.164 + </toolbox> 1.165 + 1.166 + <scale id="scale" min="1" max="10"/> 1.167 + <scale id="scale-disabled" min="1" max="10" disabled="true"/> 1.168 + 1.169 + <tabbox> 1.170 + <tabs> 1.171 + <tab id="tab" label="tab1" tooltip="tooltip"/> 1.172 + <tab id="tab-disabled" label="tab1" disabled="true"/> 1.173 + </tabs> 1.174 + <tabpanels> 1.175 + <tabpanel/> 1.176 + <tabpanel/> 1.177 + </tabpanels> 1.178 + </tabbox> 1.179 + 1.180 + <tooltip id="tooltip"><description>tooltip</description></tooltip> 1.181 + </vbox> 1.182 + </hbox> 1.183 + 1.184 +</window> 1.185 +