blob: 356b00928cb07dffaa0dfc08515fdb79604a4374 [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.testRunner)
testRunner.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>