1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_focus_selects.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,118 @@ 1.4 +<html> 1.5 + 1.6 +<head> 1.7 + <title>Accessible focus testing</title> 1.8 + 1.9 + <link rel="stylesheet" type="text/css" 1.10 + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.16 + 1.17 + <script type="application/javascript" 1.18 + src="../common.js"></script> 1.19 + <script type="application/javascript" 1.20 + src="../events.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../role.js"></script> 1.23 + <script type="application/javascript" 1.24 + src="../states.js"></script> 1.25 + 1.26 + <script type="application/javascript"> 1.27 + //gA11yEventDumpID = "eventdump"; // debug stuff 1.28 + //gA11yEventDumpToConsole = true; 1.29 + 1.30 + var gQueue = null; 1.31 + 1.32 + function doTests() 1.33 + { 1.34 + // Bug 746534 - File causes crash or hang on OS X 1.35 + if (MAC) { 1.36 + todo(false, "Bug 746534 - test file causes crash or hang on OS X"); 1.37 + SimpleTest.finish(); 1.38 + return; 1.39 + } 1.40 + 1.41 + gQueue = new eventQueue(); 1.42 + 1.43 + // first item is focused until there's selection 1.44 + gQueue.push(new synthFocus("list", new focusChecker("orange"))); 1.45 + 1.46 + // item is selected and stays focused 1.47 + gQueue.push(new synthDownKey("list", new nofocusChecker())); 1.48 + 1.49 + // last selected item is focused 1.50 + gQueue.push(new synthDownKey("list", new focusChecker("apple"), { shiftKey: true })); 1.51 + 1.52 + // no focus event if nothing is changed 1.53 + gQueue.push(new synthDownKey("list", new nofocusChecker("apple"))); 1.54 + 1.55 + // current item is focused 1.56 + gQueue.push(new synthUpKey("list", new focusChecker("orange"), { ctrlKey: true })); 1.57 + 1.58 + // focus on empty list (no items to be focused) 1.59 + gQueue.push(new synthTab("list", new focusChecker("emptylist"))); 1.60 + 1.61 + // current item is focused 1.62 + gQueue.push(new synthShiftTab("emptylist", new focusChecker("orange"))); 1.63 + 1.64 + // collapsed combobox keeps a focus 1.65 + gQueue.push(new synthFocus("combobox", new focusChecker("combobox"))); 1.66 + gQueue.push(new synthDownKey("combobox", new nofocusChecker("combobox"))); 1.67 + 1.68 + // selected item is focused for expanded combobox 1.69 + gQueue.push(new synthOpenComboboxKey("combobox", new focusChecker("cb_apple"))); 1.70 + gQueue.push(new synthUpKey("combobox", new focusChecker("cb_orange"))); 1.71 + 1.72 + // collapsed combobx keeps a focus 1.73 + gQueue.push(new synthEscapeKey("combobox", new focusChecker("combobox"))); 1.74 + 1.75 + // no focus events for unfocused list controls when current item is 1.76 + // changed 1.77 + gQueue.push(new synthFocus("emptylist")); 1.78 + 1.79 + gQueue.push(new changeCurrentItem("list", "orange")); 1.80 + gQueue.push(new changeCurrentItem("combobox", "cb_apple")); 1.81 + 1.82 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.83 + } 1.84 + 1.85 + SimpleTest.waitForExplicitFinish(); 1.86 + addA11yLoadEvent(doTests); 1.87 + </script> 1.88 +</head> 1.89 + 1.90 +<body> 1.91 + 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 + <p id="display"></p> 1.103 + <div id="content" style="display: none"></div> 1.104 + <pre id="test"> 1.105 + </pre> 1.106 + 1.107 + <select id="list" size="5" multiple=""> 1.108 + <option id="orange">Orange</option> 1.109 + <option id="apple">Apple</option> 1.110 + </select> 1.111 + 1.112 + <select id="emptylist" size="5"></select> 1.113 + 1.114 + <select id="combobox"> 1.115 + <option id="cb_orange">Orange</option> 1.116 + <option id="cb_apple">Apple</option> 1.117 + </select> 1.118 + 1.119 + <div id="eventdump"></div> 1.120 +</body> 1.121 +</html>