test_bug1305282.html (1410B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=615697 5 --> 6 <head> 7 <title>Test for Bug 1305282</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1305282">Mozilla Bug 1305282</a> 14 <p id="display"></p> 15 <div id="content"> 16 <select> 17 <option>f o o</option> 18 <option>b a r</option> 19 <option>b o o</option> 20 </select> 21 </div> 22 <pre id="test"> 23 <script type="application/javascript"> 24 25 /** Test for Bug 1305282 */ 26 27 var select = document.getElementsByTagName('select')[0]; 28 29 select.addEventListener("change", function(aEvent) { 30 is(select.selectedIndex, 1, "'b a r' option is selected"); 31 SimpleTest.finish(); 32 }, {once: true}); 33 34 select.addEventListener("focus", function() { 35 SimpleTest.executeSoon(function () { 36 synthesizeKey("KEY_ArrowDown"); 37 SimpleTest.executeSoon(function () { 38 sendString("b"); 39 SimpleTest.executeSoon(function () { 40 sendString(" "); 41 SimpleTest.executeSoon(function () { 42 synthesizeKey("KEY_Enter"); 43 }); 44 }); 45 }); 46 }); 47 }, {once: true}); 48 49 SimpleTest.waitForExplicitFinish(); 50 SimpleTest.waitForFocus(function() { 51 select.focus(); 52 }); 53 54 </script> 55 </pre> 56 </body> 57 </html>