test_bug1203668.html (1670B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1203668 5 --> 6 <head> 7 <title>Test for Bug 1203668</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1203668">Mozilla Bug 1203668</a> 13 <p id="display"></p> 14 <div id="content"> 15 <select class="select" multiple> 16 <option value="foo" selected>foo</option> 17 <option value="bar" selected>bar</option> 18 </select> 19 <select class="select" multiple> 20 <option value="foo">foo</option> 21 <option value="bar" selected>bar</option> 22 </select> 23 <select class="select" multiple> 24 <option value="foo">foo</option> 25 <option value="bar">bar</option> 26 </select> 27 <select class="select" size=1> 28 <option value="foo">foo</option> 29 <option value="bar" selected>bar</option> 30 </select> 31 <select class="select" size=1> 32 <option value="foo">foo</option> 33 <option value="bar">bar</option> 34 </select> 35 </div> 36 <pre id="test"> 37 <script type="application/javascript"> 38 39 /** Test for Bug 1203668 */ 40 41 SimpleTest.waitForExplicitFinish(); 42 43 function runTest() 44 { 45 var selects = document.querySelectorAll('.select'); 46 for (i=0; i < selects.length; i++) { 47 var select = selects[i]; 48 select.value = "bogus" 49 is(select.selectedIndex, -1, "no option is selected"); 50 is(select.children[0].selected, false, "first option is not selected"); 51 is(select.children[1].selected, false, "second option is not selected"); 52 } 53 54 SimpleTest.finish(); 55 } 56 57 SimpleTest.waitForFocus(runTest); 58 59 </script> 60 </pre> 61 </body> 62 </html>