| Index: LayoutTests/fast/forms/reportValidity-invalid.html
|
| diff --git a/LayoutTests/fast/forms/reportValidity-invalid.html b/LayoutTests/fast/forms/reportValidity-invalid.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..eb4845f64b12d9a991e8ef903f9477ba7027bf3f
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/forms/reportValidity-invalid.html
|
| @@ -0,0 +1,50 @@
|
| +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
| +<html>
|
| +<head>
|
| +<script src="../../resources/js-test.js"></script>
|
| +</head>
|
| +<body>
|
| +<p id="description"></p>
|
| +<form method="get" id="sad-form">
|
| +<input id="input-empty" name="victim" type="text" required/>
|
| +<input id="input-pattern-mismatch" name="victim" type="text" pattern="Lorem ipsum" value="Loremipsum"/>
|
| +<textarea id="textarea" name="victim" required></textarea>
|
| +<select id="select-no-explicit-value" required>
|
| + <option>empty</option>
|
| + <option>another</option>
|
| +</select>
|
| +<select id="select-placeholder" name="victim" required>
|
| + <option value="" selected />
|
| + <option value="X">X</option>
|
| +</select>
|
| +<select id="select-non-placeholder" name="victim" required>
|
| + <option value="X">X</option>
|
| + <option value="" selected />
|
| +</select>
|
| +</form>
|
| +<div id="console"></div>
|
| +<script>
|
| + function $(id) { return document.getElementById(id); }
|
| + function reportValidityFor(id) {
|
| + return document.getElementById(id).reportValidity();
|
| + }
|
| +
|
| + description("This test checks if reportValidity() returns correctly a false (meaning error) result on invalid elements, and returns a true result on a blank but valid elements. Blank but non-placeholder label options are valid.");
|
| +
|
| + shouldBeFalse('reportValidityFor("input-empty")');
|
| + shouldBe('document.activeElement', '$("input-empty")');
|
| + shouldBeFalse('reportValidityFor("input-pattern-mismatch")');
|
| + shouldBe('document.activeElement', '$("input-pattern-mismatch")');
|
| + shouldBeFalse('reportValidityFor("textarea")');
|
| + shouldBe('document.activeElement', '$("textarea")');
|
| + shouldBeTrue('reportValidityFor("select-no-explicit-value")');
|
| + shouldNotBe('document.activeElement', '$("select-no-explicit-value")');
|
| + shouldBeFalse('reportValidityFor("select-placeholder")');
|
| + shouldBe('document.activeElement', '$("select-placeholder")');
|
| + shouldBeTrue('reportValidityFor("select-non-placeholder")');
|
| + shouldNotBe('document.activeElement', '$("select-non-placeholder")');
|
| + shouldBeFalse('reportValidityFor("sad-form")');
|
| + shouldBe('document.activeElement', '$("input-empty")');
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|