blob: 1b789482280f35e6bc5a5c5864ce407708335115 [file] [log] [blame]
<html>
<head>
</head>
<body>
<form>
<input id="checkboxUnchecked" type="checkbox" value="Unchecked"><br>
<input id="checkboxChecked" type="checkbox" value="Checked" checked="checked"><br>
<input id="radioUnchecked" name="radio1" type="radio" value="Unchecked"><br>
<input id="radioChecked" name="radio1" type="radio" value="Checked" checked="checked"><br>
<input id="inputReset" type="reset">
<button id="buttonReset" type="reset">Reset Button</button>
</form>
<p>This test verifies that check-type input form controls are properly reset by
both a reset input control and a reset button control.
<p>You should see four element IDs below, and the word "SUCCESS" twice after each:</p>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var inputReset = document.getElementById("inputReset");
var buttonReset = document.getElementById("buttonReset");
function testChecked(testElement, expected, button)
{
var success = false;
if (testElement.checked == expected)
{
testElement.checked = !expected;
button.click();
if (testElement.checked == expected)
success = true;
}
if (success)
document.writeln(": SUCCESS");
else
document.writeln(": FAILED (checked = " + testElement.checked + ")");
}
function test(elementId, expected)
{
var element = document.getElementById(elementId);
document.writeln(elementId);
testChecked(element, expected, inputReset);
testChecked(element, expected, buttonReset);
document.writeln("<br>");
}
test("checkboxUnchecked", false);
test("checkboxChecked", true);
test("radioUnchecked", false);
test("radioChecked", true);
</script>
</body>
</html>