mirror of
https://github.com/servo/servo.git
synced 2025-09-11 07:28:19 +01:00
Auto merge of #13762 - frewsxcv:select-reset, r=Manishearth
Implement "reset algorithm" for `<select>`. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13762) <!-- Reviewable:end -->
This commit is contained in:
commit
28be83bd9a
4 changed files with 31 additions and 7 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue