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