test_listcontrol_search.html (1270B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=849438 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for <select> list control search</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <script src="/tests/SimpleTest/EventUtils.js"></script> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 12 <script type="application/javascript"> 13 14 /** 15 * This test will focus a select element and press a key that matches the 16 * first non-space character of an entry. 17 */ 18 19 SimpleTest.waitForExplicitFinish(); 20 SimpleTest.waitForFocus(function() { 21 var select = document.getElementsByTagName('select')[0]; 22 select.focus(); 23 sendString('a'); 24 25 is(select.options[0].selected, false, "the first option isn't selected"); 26 is(select.options[1].selected, true, "the second option is selected"); 27 28 select.blur(); 29 30 SimpleTest.finish(); 31 }); 32 33 </script> 34 </head> 35 <body> 36 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=849438">Mozilla Bug 849438</a> 37 <p id="display"></p> 38 <div id="content"> 39 <select> 40 <option>Please select an entry</option> 41 <option> a</option> 42 <option> b</option> 43 </select> 44 </div> 45 <pre id="test"> 46 </pre> 47 </body> 48 </html>