blob: ed96776abe5ce22fc47bbd9bd187d189fb3066a6 [file] [log] [blame]
<html>
<head>
</head>
<body>
<form>
<input id="textEmpty" type="text"><br>
<input id="textValue" type="text" value="Default Value"><br>
<input id="passwordEmpty" type="password"><br>
<input id="passwordValue" type="password" value="Default Value"><br>
<input id="hiddenEmpty" type="hidden"><br>
<input id="hiddenValue" type="hidden" value="Default Value">
<input id="inputReset" type="reset">
<button id="buttonReset" type="reset">Reset Button</button>
</form>
<p>This test verifies that text-type input form controls are properly reset by
both a reset input control and a reset button control.<br>
(But file input element values can't be modified by JS, so this test can't be
used for those.)</p>
<p>You should see six 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 testValue(testElement, expected, button)
{
var success = false;
if (testElement.value == expected)
{
testElement.value = "Not Expected! " + expected;
button.click();
if (testElement.value == expected)
success = true;
}
if (success)
document.writeln(": SUCCESS");
else
document.writeln(": FAILED (value = " + testElement.value + ")");
}
function test(elementId, expected)
{
var element = document.getElementById(elementId);
document.writeln(elementId);
testValue(element, expected, inputReset);
testValue(element, expected, buttonReset);
document.writeln("<br>");
}
test("textEmpty", "");
test("textValue", "Default Value");
test("passwordEmpty", "");
test("passwordValue", "Default Value");
</script>
</body>
</html>