blob: 653bb0a204fb7c50e5c4397523f4596ed8c2bdb9 [file] [log] [blame]
<html>
<head>
<script>
function print(message, color)
{
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
paragraph.style.fontFamily = "monospace";
if (color)
paragraph.style.color = color;
document.getElementById("console").appendChild(paragraph);
}
function shouldBe(a, b)
{
var evalA = eval(a);
if (evalA == b)
print("PASS: " + a + " should be " + b + " and is.", "green");
else
print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
}
function test()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
document.getElementById('sel').options[1].selected = true;
shouldBe("document.getElementById('sel').options.selectedIndex", 1);
shouldBe("document.getElementById('sel').options[1].selected", true);
document.getElementById('sel').options[1].text = "PASS";
shouldBe("document.getElementById('sel').options[1].text", "PASS");
}
</script>
</head>
<body onload="test();">
<p>This page tests setting 'selected' and 'text' on an option element. See <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9095">http://bugzilla.opendarwin.org/show_bug.cgi?id=9095</a>.</p>
<p>If the test passes, you'll see a series of 'PASS' messages below.</p>
<hr>
<div id='console'></div>
<form>
<select id='sel'>
<option value='bad'>FAIL</option>
<option value='good'>FAIL</option>
</select>
</form>
</body>
</html>