test_option_defaultSelected.html (1266B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=927796 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 927796</title> 9 <script src="/tests/SimpleTest/SimpleTest.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=927796">Mozilla Bug 927796</a> 14 <p id="display"> 15 <select id="s1"> 16 <option selected>one</option> 17 <option>two</option> 18 </select> 19 <select id="s2" size="5"> 20 <option selected>one</option> 21 <option>two</option> 22 </select> 23 </p> 24 <div id="content" style="display: none"> 25 26 </div> 27 <pre id="test"> 28 </pre> 29 <script type="application/javascript"> 30 31 /** Test for Bug 927796 */ 32 var s1 = $("s1"); 33 s1.options[0].defaultSelected = false; 34 is(s1.options[0].selected, true, 35 "First option in combobox should still be selected"); 36 is(s1.options[1].selected, false, 37 "Second option in combobox should not be selected"); 38 39 var s2 = $("s2"); 40 s2.options[0].defaultSelected = false; 41 is(s2.options[0].selected, false, 42 "First option in listbox should not be selected"); 43 is(s2.options[1].selected, false, 44 "Second option in listbox should not be selected"); 45 </script> 46 </body> 47 </html>