1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_focus_listcontrols.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,187 @@ 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 focus event testing"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> 1.16 + 1.17 + <script type="application/javascript" 1.18 + src="../common.js" /> 1.19 + <script type="application/javascript" 1.20 + src="../role.js" /> 1.21 + <script type="application/javascript" 1.22 + src="../states.js" /> 1.23 + <script type="application/javascript" 1.24 + src="../events.js" /> 1.25 + 1.26 + <script type="application/javascript"> 1.27 + //gA11yEventDumpID = "eventdump"; // debug stuff 1.28 + gA11yEventDumpToConsole = true; // debug stuff 1.29 + 1.30 + var gQueue = null; 1.31 + function doTests() 1.32 + { 1.33 + // Test focus events. 1.34 + gQueue = new eventQueue(); 1.35 + 1.36 + gQueue.push(new synthFocus("listbox", new focusChecker("lb_item1"))); 1.37 + gQueue.push(new synthDownKey("lb_item1", new focusChecker("lb_item2"))); 1.38 + gQueue.push(new synthTab("lb_item2", new focusChecker("mslb_item1"))); 1.39 + gQueue.push(new synthDownKey("mslb_item1", new focusChecker("mslb_item2"), { shiftKey: true })); 1.40 + gQueue.push(new synthTab("mslb_item2", new focusChecker("emptylistbox"))); 1.41 + gQueue.push(new synthFocus("mcolumnlistbox", new focusChecker("mclb_item1"))); 1.42 + gQueue.push(new synthDownKey("mclb_item1", new focusChecker("mclb_item2"))); 1.43 + gQueue.push(new synthFocus("headerlistbox", new focusChecker("hlb_item1"))); 1.44 + gQueue.push(new synthDownKey("hlb_item1", new focusChecker("hlb_item2"))); 1.45 + 1.46 + gQueue.push(new synthFocus("richlistbox", new focusChecker("rlb_item1"))); 1.47 + gQueue.push(new synthDownKey("rlb_item1", new focusChecker("rlb_item2"))); 1.48 + gQueue.push(new synthFocus("multiselrichlistbox", new focusChecker("msrlb_item1"))); 1.49 + gQueue.push(new synthDownKey("msrlb_item1", new focusChecker("msrlb_item2"), { shiftKey: true })); 1.50 + gQueue.push(new synthFocus("emptyrichlistbox", new focusChecker("emptyrichlistbox"))); 1.51 + 1.52 + gQueue.push(new synthFocus("menulist")); 1.53 + gQueue.push(new synthClick("menulist", new focusChecker("ml_tangerine"))); 1.54 + gQueue.push(new synthDownKey("ml_tangerine", new focusChecker("ml_marmalade"))); 1.55 + gQueue.push(new synthEscapeKey("ml_marmalade", new focusChecker("menulist"))); 1.56 +if (!MAC) { 1.57 + gQueue.push(new synthDownKey("menulist", new nofocusChecker("ml_marmalade"))); 1.58 + gQueue.push(new synthOpenComboboxKey("menulist", new focusChecker("ml_marmalade"))); 1.59 + gQueue.push(new synthEnterKey("ml_marmalade", new focusChecker("menulist"))); 1.60 +} else { 1.61 + todo(false, "Bug 746531 - timeouts of last three menulist tests on OS X"); 1.62 +} 1.63 + 1.64 + var textentry = getAccessible("emenulist").firstChild; 1.65 + gQueue.push(new synthFocus("emenulist", new focusChecker(textentry))); 1.66 + gQueue.push(new synthDownKey(textentry, new nofocusChecker("eml_tangerine"))); 1.67 + gQueue.push(new synthUpKey(textentry, new focusChecker("eml_marmalade"))); 1.68 + gQueue.push(new synthEnterKey("eml_marmalade", new focusChecker(textentry))); 1.69 + gQueue.push(new synthOpenComboboxKey("emenulist", new focusChecker("eml_marmalade"))); 1.70 + gQueue.push(new synthEscapeKey("eml_marmalade", new focusChecker(textentry))); 1.71 + 1.72 + // no focus events for unfocused list controls when current item is 1.73 + // changed. 1.74 + gQueue.push(new synthFocus("emptylistbox")); 1.75 + 1.76 + gQueue.push(new changeCurrentItem("listbox", "lb_item1")); 1.77 + gQueue.push(new changeCurrentItem("richlistbox", "rlb_item1")); 1.78 +if (!MAC) { 1.79 + gQueue.push(new changeCurrentItem("menulist", "ml_tangerine")); 1.80 +} 1.81 + gQueue.push(new changeCurrentItem("emenulist", "eml_tangerine")); 1.82 + 1.83 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.84 + } 1.85 + 1.86 + SimpleTest.waitForExplicitFinish(); 1.87 + addA11yLoadEvent(doTests); 1.88 + </script> 1.89 + 1.90 + <hbox flex="1" style="overflow: auto;"> 1.91 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.92 + <a target="_blank" 1.93 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=433418" 1.94 + title="Accessibles for focused HTML Select elements are not getting focused state"> 1.95 + Mozilla Bug 433418 1.96 + </a> 1.97 + <a target="_blank" 1.98 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=474893" 1.99 + 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"> 1.100 + Mozilla Bug 474893 1.101 + </a> 1.102 + <a target="_blank" 1.103 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=552368" 1.104 + title=" fire focus event on document accessible whenever the root or body element is focused"> 1.105 + Mozilla Bug 552368 1.106 + </a> 1.107 + <p id="display"></p> 1.108 + <div id="content" style="display: none"></div> 1.109 + <pre id="test"> 1.110 + </pre> 1.111 + </body> 1.112 + 1.113 + <vbox flex="1"> 1.114 + <listbox id="listbox" rows="3"> 1.115 + <listitem id="lb_item1" label="item1"/> 1.116 + <listitem id="lb_item2" label="item1"/> 1.117 + </listbox> 1.118 + <listbox id="multisellistbox" rows="3" seltype="multiple"> 1.119 + <listitem id="mslb_item1" label="item1"/> 1.120 + <listitem id="mslb_item2" label="item1"/> 1.121 + </listbox> 1.122 + <listbox id="emptylistbox" rows="3"/> 1.123 + <listbox id="mcolumnlistbox" rows="3"> 1.124 + <listcols> 1.125 + <listcol/> 1.126 + <listcol/> 1.127 + </listcols> 1.128 + <listitem id="mclb_item1"> 1.129 + <listcell label="George"/> 1.130 + <listcell label="House Painter"/> 1.131 + </listitem> 1.132 + <listitem id="mclb_item2"> 1.133 + <listcell label="Mary Ellen"/> 1.134 + <listcell label="Candle Maker"/> 1.135 + </listitem> 1.136 + </listbox> 1.137 + <listbox id="headerlistbox" rows="3"> 1.138 + <listhead> 1.139 + <listheader label="Name"/> 1.140 + <listheader label="Occupation"/> 1.141 + </listhead> 1.142 + <listcols> 1.143 + <listcol/> 1.144 + <listcol flex="1"/> 1.145 + </listcols> 1.146 + <listitem id="hlb_item1"> 1.147 + <listcell label="George"/> 1.148 + <listcell label="House Painter"/> 1.149 + </listitem> 1.150 + <listitem id="hlb_item2"> 1.151 + <listcell label="Mary Ellen"/> 1.152 + <listcell label="Candle Maker"/> 1.153 + </listitem> 1.154 + </listbox> 1.155 + 1.156 + <richlistbox id="richlistbox"> 1.157 + <richlistitem id="rlb_item1"> 1.158 + <description>A XUL Description!</description> 1.159 + </richlistitem> 1.160 + <richlistitem id="rlb_item2"> 1.161 + <button label="A XUL Button"/> 1.162 + </richlistitem> 1.163 + </richlistbox> 1.164 + <richlistbox id="multiselrichlistbox" seltype="multiple"> 1.165 + <richlistitem id="msrlb_item1"> 1.166 + <description>A XUL Description!</description> 1.167 + </richlistitem> 1.168 + <richlistitem id="msrlb_item2"> 1.169 + <button label="A XUL Button"/> 1.170 + </richlistitem> 1.171 + </richlistbox> 1.172 + <richlistbox id="emptyrichlistbox" seltype="multiple"/> 1.173 + 1.174 + <menulist id="menulist"> 1.175 + <menupopup> 1.176 + <menuitem id="ml_tangerine" label="tangerine trees"/> 1.177 + <menuitem id="ml_marmalade" label="marmalade skies"/> 1.178 + </menupopup> 1.179 + </menulist> 1.180 + <menulist id="emenulist" editable="true"> 1.181 + <menupopup> 1.182 + <menuitem id="eml_tangerine" label="tangerine trees"/> 1.183 + <menuitem id="eml_marmalade" label="marmalade skies"/> 1.184 + </menupopup> 1.185 + </menulist> 1.186 + 1.187 + <vbox id="eventdump"/> 1.188 + </vbox> 1.189 + </hbox> 1.190 +</window>