Make 'reset-form.html' test more granular.

This commit is contained in:
Corey Farwell 2016-10-20 00:00:57 -04:00
parent a45e1d9d95
commit 957e1d8e7a
2 changed files with 20 additions and 5 deletions

View file

@ -1,11 +1,11 @@
[reset-form.html]
type: testharness
[Resetting the form by calling the reset() method]
[Resetting <output> by calling the reset() method]
expected: FAIL
[Resetting the form by clicking the button in reset status]
[Resetting <output> by clicking the button in reset status]
expected: FAIL
[Resetting the form by clicking the input in reset status]
[Resetting <output> by clicking the input in reset status]
expected: FAIL

View file

@ -87,10 +87,25 @@ function runTest(reset, description) {
assert_false(document.getElementById("rd2").checked, "The checked attribute of the input element in radio should be false.");
assert_true(document.getElementById("cb1").checked, "The checked attribute of the input element in checkbox should be true.");
assert_false(document.getElementById("cb2").checked, "The checked attribute of the input element in checkbox should be false.");
}, "Resetting <input> " + description);
test(function() {
setPreconditions("Setting preconditions for resetting " + description);
reset();
assert_equals(document.getElementById("ta").value, document.getElementById("ta").textContent, "The value attribute of the textarea element should be reset.");
assert_equals(document.getElementById("ta").value, "abc", "The value attribute of the textarea element should be 'abc'.");
}, "Resetting <textarea> " + description);
test(function() {
setPreconditions("Setting preconditions for resetting " + description);
reset();
assert_equals(document.getElementById("opt").textContent, document.getElementById("opt").defaultValue, "The textContent of the output element should be reset.");
assert_equals(document.getElementById("opt").textContent, "abc", "The textContent of the output element should be 'abc'.");
}, "Resetting <output> " + description);
test(function() {
setPreconditions("Setting preconditions for resetting " + description);
reset();
assert_true(document.getElementById("slt1").options[0].selected, "The first option in the select element should be selected.");
assert_false(document.getElementById("slt1").options[1].selected, "The second option in the select element should not be selected.");
assert_false(document.getElementById("slt2").options[0].selected, "The first option in the select element should not be selected.");
@ -98,8 +113,8 @@ function runTest(reset, description) {
assert_false(document.getElementById("slt3").options[0].selected, "The first option in the select element with multiple attribute should not be selected.");
assert_true(document.getElementById("slt3").options[1].selected, "The second option in the select element with multiple attribute should be selected.");
assert_true(document.getElementById("slt3").options[2].selected, "The third option in the select element with multiple attribute should be selected.");
//TODO: The keygen reset algorithm
}, "Resetting the form " + description);
}, "Resetting <select> " + description);
//TODO: The keygen reset algorithm
}
</script>