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 focus event testing"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 13 | |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../common.js" /> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../role.js" /> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../states.js" /> |
michael@0 | 20 | <script type="application/javascript" |
michael@0 | 21 | src="../events.js" /> |
michael@0 | 22 | |
michael@0 | 23 | <script type="application/javascript"> |
michael@0 | 24 | //gA11yEventDumpID = "eventdump"; // debug stuff |
michael@0 | 25 | gA11yEventDumpToConsole = true; // debug stuff |
michael@0 | 26 | |
michael@0 | 27 | var gQueue = null; |
michael@0 | 28 | function doTests() |
michael@0 | 29 | { |
michael@0 | 30 | // Test focus events. |
michael@0 | 31 | gQueue = new eventQueue(); |
michael@0 | 32 | |
michael@0 | 33 | gQueue.push(new synthFocus("listbox", new focusChecker("lb_item1"))); |
michael@0 | 34 | gQueue.push(new synthDownKey("lb_item1", new focusChecker("lb_item2"))); |
michael@0 | 35 | gQueue.push(new synthTab("lb_item2", new focusChecker("mslb_item1"))); |
michael@0 | 36 | gQueue.push(new synthDownKey("mslb_item1", new focusChecker("mslb_item2"), { shiftKey: true })); |
michael@0 | 37 | gQueue.push(new synthTab("mslb_item2", new focusChecker("emptylistbox"))); |
michael@0 | 38 | gQueue.push(new synthFocus("mcolumnlistbox", new focusChecker("mclb_item1"))); |
michael@0 | 39 | gQueue.push(new synthDownKey("mclb_item1", new focusChecker("mclb_item2"))); |
michael@0 | 40 | gQueue.push(new synthFocus("headerlistbox", new focusChecker("hlb_item1"))); |
michael@0 | 41 | gQueue.push(new synthDownKey("hlb_item1", new focusChecker("hlb_item2"))); |
michael@0 | 42 | |
michael@0 | 43 | gQueue.push(new synthFocus("richlistbox", new focusChecker("rlb_item1"))); |
michael@0 | 44 | gQueue.push(new synthDownKey("rlb_item1", new focusChecker("rlb_item2"))); |
michael@0 | 45 | gQueue.push(new synthFocus("multiselrichlistbox", new focusChecker("msrlb_item1"))); |
michael@0 | 46 | gQueue.push(new synthDownKey("msrlb_item1", new focusChecker("msrlb_item2"), { shiftKey: true })); |
michael@0 | 47 | gQueue.push(new synthFocus("emptyrichlistbox", new focusChecker("emptyrichlistbox"))); |
michael@0 | 48 | |
michael@0 | 49 | gQueue.push(new synthFocus("menulist")); |
michael@0 | 50 | gQueue.push(new synthClick("menulist", new focusChecker("ml_tangerine"))); |
michael@0 | 51 | gQueue.push(new synthDownKey("ml_tangerine", new focusChecker("ml_marmalade"))); |
michael@0 | 52 | gQueue.push(new synthEscapeKey("ml_marmalade", new focusChecker("menulist"))); |
michael@0 | 53 | if (!MAC) { |
michael@0 | 54 | gQueue.push(new synthDownKey("menulist", new nofocusChecker("ml_marmalade"))); |
michael@0 | 55 | gQueue.push(new synthOpenComboboxKey("menulist", new focusChecker("ml_marmalade"))); |
michael@0 | 56 | gQueue.push(new synthEnterKey("ml_marmalade", new focusChecker("menulist"))); |
michael@0 | 57 | } else { |
michael@0 | 58 | todo(false, "Bug 746531 - timeouts of last three menulist tests on OS X"); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | var textentry = getAccessible("emenulist").firstChild; |
michael@0 | 62 | gQueue.push(new synthFocus("emenulist", new focusChecker(textentry))); |
michael@0 | 63 | gQueue.push(new synthDownKey(textentry, new nofocusChecker("eml_tangerine"))); |
michael@0 | 64 | gQueue.push(new synthUpKey(textentry, new focusChecker("eml_marmalade"))); |
michael@0 | 65 | gQueue.push(new synthEnterKey("eml_marmalade", new focusChecker(textentry))); |
michael@0 | 66 | gQueue.push(new synthOpenComboboxKey("emenulist", new focusChecker("eml_marmalade"))); |
michael@0 | 67 | gQueue.push(new synthEscapeKey("eml_marmalade", new focusChecker(textentry))); |
michael@0 | 68 | |
michael@0 | 69 | // no focus events for unfocused list controls when current item is |
michael@0 | 70 | // changed. |
michael@0 | 71 | gQueue.push(new synthFocus("emptylistbox")); |
michael@0 | 72 | |
michael@0 | 73 | gQueue.push(new changeCurrentItem("listbox", "lb_item1")); |
michael@0 | 74 | gQueue.push(new changeCurrentItem("richlistbox", "rlb_item1")); |
michael@0 | 75 | if (!MAC) { |
michael@0 | 76 | gQueue.push(new changeCurrentItem("menulist", "ml_tangerine")); |
michael@0 | 77 | } |
michael@0 | 78 | gQueue.push(new changeCurrentItem("emenulist", "eml_tangerine")); |
michael@0 | 79 | |
michael@0 | 80 | gQueue.invoke(); // Will call SimpleTest.finish(); |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 84 | addA11yLoadEvent(doTests); |
michael@0 | 85 | </script> |
michael@0 | 86 | |
michael@0 | 87 | <hbox flex="1" style="overflow: auto;"> |
michael@0 | 88 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 89 | <a target="_blank" |
michael@0 | 90 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=433418" |
michael@0 | 91 | title="Accessibles for focused HTML Select elements are not getting focused state"> |
michael@0 | 92 | Mozilla Bug 433418 |
michael@0 | 93 | </a> |
michael@0 | 94 | <a target="_blank" |
michael@0 | 95 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=474893" |
michael@0 | 96 | title="List controls should fire a focus event on the selected child when tabbing or when the selected child changes while the list is focused"> |
michael@0 | 97 | Mozilla Bug 474893 |
michael@0 | 98 | </a> |
michael@0 | 99 | <a target="_blank" |
michael@0 | 100 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=552368" |
michael@0 | 101 | title=" fire focus event on document accessible whenever the root or body element is focused"> |
michael@0 | 102 | Mozilla Bug 552368 |
michael@0 | 103 | </a> |
michael@0 | 104 | <p id="display"></p> |
michael@0 | 105 | <div id="content" style="display: none"></div> |
michael@0 | 106 | <pre id="test"> |
michael@0 | 107 | </pre> |
michael@0 | 108 | </body> |
michael@0 | 109 | |
michael@0 | 110 | <vbox flex="1"> |
michael@0 | 111 | <listbox id="listbox" rows="3"> |
michael@0 | 112 | <listitem id="lb_item1" label="item1"/> |
michael@0 | 113 | <listitem id="lb_item2" label="item1"/> |
michael@0 | 114 | </listbox> |
michael@0 | 115 | <listbox id="multisellistbox" rows="3" seltype="multiple"> |
michael@0 | 116 | <listitem id="mslb_item1" label="item1"/> |
michael@0 | 117 | <listitem id="mslb_item2" label="item1"/> |
michael@0 | 118 | </listbox> |
michael@0 | 119 | <listbox id="emptylistbox" rows="3"/> |
michael@0 | 120 | <listbox id="mcolumnlistbox" rows="3"> |
michael@0 | 121 | <listcols> |
michael@0 | 122 | <listcol/> |
michael@0 | 123 | <listcol/> |
michael@0 | 124 | </listcols> |
michael@0 | 125 | <listitem id="mclb_item1"> |
michael@0 | 126 | <listcell label="George"/> |
michael@0 | 127 | <listcell label="House Painter"/> |
michael@0 | 128 | </listitem> |
michael@0 | 129 | <listitem id="mclb_item2"> |
michael@0 | 130 | <listcell label="Mary Ellen"/> |
michael@0 | 131 | <listcell label="Candle Maker"/> |
michael@0 | 132 | </listitem> |
michael@0 | 133 | </listbox> |
michael@0 | 134 | <listbox id="headerlistbox" rows="3"> |
michael@0 | 135 | <listhead> |
michael@0 | 136 | <listheader label="Name"/> |
michael@0 | 137 | <listheader label="Occupation"/> |
michael@0 | 138 | </listhead> |
michael@0 | 139 | <listcols> |
michael@0 | 140 | <listcol/> |
michael@0 | 141 | <listcol flex="1"/> |
michael@0 | 142 | </listcols> |
michael@0 | 143 | <listitem id="hlb_item1"> |
michael@0 | 144 | <listcell label="George"/> |
michael@0 | 145 | <listcell label="House Painter"/> |
michael@0 | 146 | </listitem> |
michael@0 | 147 | <listitem id="hlb_item2"> |
michael@0 | 148 | <listcell label="Mary Ellen"/> |
michael@0 | 149 | <listcell label="Candle Maker"/> |
michael@0 | 150 | </listitem> |
michael@0 | 151 | </listbox> |
michael@0 | 152 | |
michael@0 | 153 | <richlistbox id="richlistbox"> |
michael@0 | 154 | <richlistitem id="rlb_item1"> |
michael@0 | 155 | <description>A XUL Description!</description> |
michael@0 | 156 | </richlistitem> |
michael@0 | 157 | <richlistitem id="rlb_item2"> |
michael@0 | 158 | <button label="A XUL Button"/> |
michael@0 | 159 | </richlistitem> |
michael@0 | 160 | </richlistbox> |
michael@0 | 161 | <richlistbox id="multiselrichlistbox" seltype="multiple"> |
michael@0 | 162 | <richlistitem id="msrlb_item1"> |
michael@0 | 163 | <description>A XUL Description!</description> |
michael@0 | 164 | </richlistitem> |
michael@0 | 165 | <richlistitem id="msrlb_item2"> |
michael@0 | 166 | <button label="A XUL Button"/> |
michael@0 | 167 | </richlistitem> |
michael@0 | 168 | </richlistbox> |
michael@0 | 169 | <richlistbox id="emptyrichlistbox" seltype="multiple"/> |
michael@0 | 170 | |
michael@0 | 171 | <menulist id="menulist"> |
michael@0 | 172 | <menupopup> |
michael@0 | 173 | <menuitem id="ml_tangerine" label="tangerine trees"/> |
michael@0 | 174 | <menuitem id="ml_marmalade" label="marmalade skies"/> |
michael@0 | 175 | </menupopup> |
michael@0 | 176 | </menulist> |
michael@0 | 177 | <menulist id="emenulist" editable="true"> |
michael@0 | 178 | <menupopup> |
michael@0 | 179 | <menuitem id="eml_tangerine" label="tangerine trees"/> |
michael@0 | 180 | <menuitem id="eml_marmalade" label="marmalade skies"/> |
michael@0 | 181 | </menupopup> |
michael@0 | 182 | </menulist> |
michael@0 | 183 | |
michael@0 | 184 | <vbox id="eventdump"/> |
michael@0 | 185 | </vbox> |
michael@0 | 186 | </hbox> |
michael@0 | 187 | </window> |