Skip to content

Commit

Permalink
Add wpt for :valid and :invalid pseudo-class on output element
Browse files Browse the repository at this point in the history
Depends on D129325

Differential Revision: https://phabricator.services.mozilla.com/D129440

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1737360
gecko-commit: 69323028553b7213ab1b45b48006ebcd1da06f94
gecko-reviewers: smaug
  • Loading branch information
EdgarChen authored and pull[bot] committed Jan 23, 2024
1 parent 3cd0b44 commit 1370977
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions html/semantics/forms/the-output-element/output-validity.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE HTML>
<title>:valid and :invalid pseudo-class on output element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<output id='output_test'></output>

<script>

test(() => {
let output = document.getElementById("output_test");
assert_false(output.matches(":valid"), "should not match :valid pseudo-class");
assert_false(output.matches(":invalid"), "should not match :invalid pseudo-class");

output.setCustomValidity("custom error");
assert_equals(output.validationMessage, "", "should not have a validation message");
assert_true(output.validity.customError, "should have a custom error");
assert_false(output.validity.valid, "should not be valid with a custom error");
assert_false(output.matches(":valid"), "should still not match :valid pseudo-class");
assert_false(output.matches(":invalid"), "should still not match :invalid pseudo-class");
}, ":valid and :invalid pseudo-class on output element")

</script>

0 comments on commit 1370977

Please sign in to comment.