test_selection.html (3757B)
1 <html> 2 3 <head> 4 <title>Accessible selection event testing</title> 5 6 <link rel="stylesheet" type="text/css" 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 11 12 <script type="application/javascript" 13 src="../common.js"></script> 14 <script type="application/javascript" 15 src="../events.js"></script> 16 <script type="application/javascript" 17 src="../role.js"></script> 18 <script type="application/javascript" 19 src="../states.js"></script> 20 21 <script type="application/javascript"> 22 // ////////////////////////////////////////////////////////////////////////// 23 // Invokers 24 25 // ////////////////////////////////////////////////////////////////////////// 26 // Do tests 27 28 // gA11yEventDumpToConsole = true; // debuggin 29 30 var gQueue = null; 31 function doTests() { 32 gQueue = new eventQueue(); 33 34 35 // closed combobox 36 gQueue.push(new synthFocus("combobox")); 37 gQueue.push(new synthDownKey("cb1_item1", 38 selChangeSeq("cb1_item1", "cb1_item2"))); 39 40 // listbox 41 gQueue.push(new synthClick("lb1_item1", 42 new invokerChecker(EVENT_SELECTION, "lb1_item1"))); 43 gQueue.push(new synthDownKey("lb1_item1", 44 selChangeSeq("lb1_item1", "lb1_item2"))); 45 46 // multiselectable listbox 47 gQueue.push(new synthClick("lb2_item1", 48 selChangeSeq(null, "lb2_item1"))); 49 gQueue.push(new synthDownKey("lb2_item1", 50 selAddSeq("lb2_item2"), 51 { shiftKey: true })); 52 gQueue.push(new synthUpKey("lb2_item2", 53 selRemoveSeq("lb2_item2"), 54 { shiftKey: true })); 55 gQueue.push(new synthKey("lb2_item1", " ", { ctrlKey: true }, 56 selRemoveSeq("lb2_item1"))); 57 58 gQueue.invoke(); // Will call SimpleTest.finish(); 59 } 60 61 SimpleTest.waitForExplicitFinish(); 62 addA11yLoadEvent(doTests); 63 </script> 64 </head> 65 66 <body> 67 68 <a target="_blank" 69 href="https://bugzilla.mozilla.org/show_bug.cgi?id=414302" 70 title="Incorrect selection events in HTML, XUL and ARIA"> 71 Bug 414302 72 </a> 73 <a target="_blank" 74 href="https://bugzilla.mozilla.org/show_bug.cgi?id=810268" 75 title="There's no way to know unselected item when selection in single selection was changed"> 76 Bug 810268 77 </a> 78 79 <p id="display"></p> 80 <div id="content" style="display: none"></div> 81 <pre id="test"> 82 </pre> 83 84 <select id="combobox"> 85 <option id="cb1_item1" value="mushrooms">mushrooms 86 <option id="cb1_item2" value="greenpeppers">green peppers 87 <option id="cb1_item3" value="onions" id="onions">onions 88 <option id="cb1_item4" value="tomatoes">tomatoes 89 <option id="cb1_item5" value="olives">olives 90 </select> 91 92 <select id="listbox" size=5> 93 <option id="lb1_item1" value="mushrooms">mushrooms 94 <option id="lb1_item2" value="greenpeppers">green peppers 95 <option id="lb1_item3" value="onions" id="onions">onions 96 <option id="lb1_item4" value="tomatoes">tomatoes 97 <option id="lb1_item5" value="olives">olives 98 </select> 99 100 <p>Pizza</p> 101 <select id="listbox2" multiple size=5> 102 <option id="lb2_item1" value="mushrooms">mushrooms 103 <option id="lb2_item2" value="greenpeppers">green peppers 104 <option id="lb2_item3" value="onions" id="onions">onions 105 <option id="lb2_item4" value="tomatoes">tomatoes 106 <option id="lb2_item5" value="olives">olives 107 </select> 108 </body> 109 </html>