accessible/tests/mochitest/events/test_focus_selects.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <html>
michael@0 2
michael@0 3 <head>
michael@0 4 <title>Accessible focus testing</title>
michael@0 5
michael@0 6 <link rel="stylesheet" type="text/css"
michael@0 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 11 <script type="application/javascript"
michael@0 12 src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
michael@0 13
michael@0 14 <script type="application/javascript"
michael@0 15 src="../common.js"></script>
michael@0 16 <script type="application/javascript"
michael@0 17 src="../events.js"></script>
michael@0 18 <script type="application/javascript"
michael@0 19 src="../role.js"></script>
michael@0 20 <script type="application/javascript"
michael@0 21 src="../states.js"></script>
michael@0 22
michael@0 23 <script type="application/javascript">
michael@0 24 //gA11yEventDumpID = "eventdump"; // debug stuff
michael@0 25 //gA11yEventDumpToConsole = true;
michael@0 26
michael@0 27 var gQueue = null;
michael@0 28
michael@0 29 function doTests()
michael@0 30 {
michael@0 31 // Bug 746534 - File causes crash or hang on OS X
michael@0 32 if (MAC) {
michael@0 33 todo(false, "Bug 746534 - test file causes crash or hang on OS X");
michael@0 34 SimpleTest.finish();
michael@0 35 return;
michael@0 36 }
michael@0 37
michael@0 38 gQueue = new eventQueue();
michael@0 39
michael@0 40 // first item is focused until there's selection
michael@0 41 gQueue.push(new synthFocus("list", new focusChecker("orange")));
michael@0 42
michael@0 43 // item is selected and stays focused
michael@0 44 gQueue.push(new synthDownKey("list", new nofocusChecker()));
michael@0 45
michael@0 46 // last selected item is focused
michael@0 47 gQueue.push(new synthDownKey("list", new focusChecker("apple"), { shiftKey: true }));
michael@0 48
michael@0 49 // no focus event if nothing is changed
michael@0 50 gQueue.push(new synthDownKey("list", new nofocusChecker("apple")));
michael@0 51
michael@0 52 // current item is focused
michael@0 53 gQueue.push(new synthUpKey("list", new focusChecker("orange"), { ctrlKey: true }));
michael@0 54
michael@0 55 // focus on empty list (no items to be focused)
michael@0 56 gQueue.push(new synthTab("list", new focusChecker("emptylist")));
michael@0 57
michael@0 58 // current item is focused
michael@0 59 gQueue.push(new synthShiftTab("emptylist", new focusChecker("orange")));
michael@0 60
michael@0 61 // collapsed combobox keeps a focus
michael@0 62 gQueue.push(new synthFocus("combobox", new focusChecker("combobox")));
michael@0 63 gQueue.push(new synthDownKey("combobox", new nofocusChecker("combobox")));
michael@0 64
michael@0 65 // selected item is focused for expanded combobox
michael@0 66 gQueue.push(new synthOpenComboboxKey("combobox", new focusChecker("cb_apple")));
michael@0 67 gQueue.push(new synthUpKey("combobox", new focusChecker("cb_orange")));
michael@0 68
michael@0 69 // collapsed combobx keeps a focus
michael@0 70 gQueue.push(new synthEscapeKey("combobox", new focusChecker("combobox")));
michael@0 71
michael@0 72 // no focus events for unfocused list controls when current item is
michael@0 73 // changed
michael@0 74 gQueue.push(new synthFocus("emptylist"));
michael@0 75
michael@0 76 gQueue.push(new changeCurrentItem("list", "orange"));
michael@0 77 gQueue.push(new changeCurrentItem("combobox", "cb_apple"));
michael@0 78
michael@0 79 gQueue.invoke(); // Will call SimpleTest.finish();
michael@0 80 }
michael@0 81
michael@0 82 SimpleTest.waitForExplicitFinish();
michael@0 83 addA11yLoadEvent(doTests);
michael@0 84 </script>
michael@0 85 </head>
michael@0 86
michael@0 87 <body>
michael@0 88
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 <p id="display"></p>
michael@0 100 <div id="content" style="display: none"></div>
michael@0 101 <pre id="test">
michael@0 102 </pre>
michael@0 103
michael@0 104 <select id="list" size="5" multiple="">
michael@0 105 <option id="orange">Orange</option>
michael@0 106 <option id="apple">Apple</option>
michael@0 107 </select>
michael@0 108
michael@0 109 <select id="emptylist" size="5"></select>
michael@0 110
michael@0 111 <select id="combobox">
michael@0 112 <option id="cb_orange">Orange</option>
michael@0 113 <option id="cb_apple">Apple</option>
michael@0 114 </select>
michael@0 115
michael@0 116 <div id="eventdump"></div>
michael@0 117 </body>
michael@0 118 </html>

mercurial