blob: b7671e2bcb5a28973c41230225ea163aba7faef4 [file] [log] [blame]
<html>
<script>
function test() {
if (window.testRunner)
testRunner.dumpAsText();
var popup = document.getElementById('popup');
var success;
// Test 0
popup.options[0] = new Option ( "option0", "0" );
if (popup.selectedIndex == 0)
success = "Passed";
else
success = "Failed";
log("Test 0 " + success + ": the selected index is " + popup.selectedIndex + ".");
// Test 1
popup.options[1] = new Option ( "option1", "1" , false, false);
if (popup.selectedIndex == 0)
success = "Passed";
else
success = "Failed";
log("Test 1 " + success + ": the selected index is " + popup.selectedIndex + ".");
// Test 2
popup.options[2] = new Option ( "option2", "2", true, false );
if (popup.selectedIndex == 0)
success = "Passed";
else
success = "Failed";
log("Test 2 " + success + ": the selected index is " + popup.selectedIndex + ".");
// Test 3
popup.options[3] = new Option ( "option3", "3", false, true );
if (popup.selectedIndex == 3)
success = "Passed";
else
success = "Failed";
log("Test 3 " + success + ": the selected index is " + popup.selectedIndex + ".");
// Test 4
popup.options[4] = new Option ( "option4", "4", true, true );
if (popup.selectedIndex == 4)
success = "Passed";
else
success = "Failed";
log("Test 4 " + success + ": the selected index is " + popup.selectedIndex + ".");
// Test 5
popup.options[5] = new Option ( "option5", "5");
if (popup.selectedIndex == 4)
success = "Passed";
else
success = "Failed";
log("Test 5 " + success + ": the selected index is " + popup.selectedIndex + ".");
}
function log(msg) {
var console = document.getElementById('console');
console.innerHTML = console.innerHTML + msg + "<br>";
}
</script>
<body onload="test()">
This tests that the "selected" argument is honored when constructing an option element.<br>
<select id="popup"></select><br>
<div id="console"></div>
</body>
</html>