| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <p id="description"></p> | |
| 8 <form method="get"> | |
| 9 <input id="input-empty" name="victim" type="text" required/> | |
| 10 <input id="input-pattern-mismatch" name="victim" type="text" pattern="Lorem ipsu
m" value="Loremipsum"/> | |
| 11 <textarea id="textarea" name="victim" required></textarea> | |
| 12 <select id="select-no-explicit-value" required> | |
| 13 <option>empty</option> | |
| 14 <option>another</option> | |
| 15 </select> | |
| 16 <select id="select-placeholder" name="victim" required> | |
| 17 <option value="" selected /> | |
| 18 <option value="X">X</option> | |
| 19 </select> | |
| 20 <select id="select-non-placeholder" name="victim" required> | |
| 21 <option value="X">X</option> | |
| 22 <option value="" selected /> | |
| 23 </select> | |
| 24 </form> | |
| 25 <div id="console"></div> | |
| 26 <script> | |
| 27 function checkValidityFor(id) { | |
| 28 return document.getElementById(id).checkValidity(); | |
| 29 } | |
| 30 | |
| 31 description("This test checks if checkValidity() 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."); | |
| 32 | |
| 33 shouldBeFalse('checkValidityFor("input-empty")'); | |
| 34 shouldBeFalse('checkValidityFor("input-pattern-mismatch")'); | |
| 35 shouldBeFalse('checkValidityFor("textarea")'); | |
| 36 shouldBeTrue('checkValidityFor("select-no-explicit-value")'); | |
| 37 shouldBeFalse('checkValidityFor("select-placeholder")'); | |
| 38 shouldBeTrue('checkValidityFor("select-non-placeholder")'); | |
| 39 </script> | |
| 40 </body> | |
| 41 </html> | |
| OLD | NEW |