Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: LayoutTests/fast/forms/reportValidity-002.html

Issue 660783002: Implement reportValidity() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Apply keishi's comments + pull Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
tkent 2014/10/22 01:14:15 The test name should be reportValidity-invalid.htm
Bartek Nowierski 2014/10/22 04:56:43 Done.
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 $(id) { return document.getElementById(id); }
28 function reportValidityFor(id) {
29 return document.getElementById(id).reportValidity();
30 }
31
32 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.");
33
34 shouldBeFalse('reportValidityFor("input-empty")');
35 shouldBe('document.activeElement', '$("input-empty")');
36 shouldBeFalse('reportValidityFor("input-pattern-mismatch")');
37 shouldBe('document.activeElement', '$("input-pattern-mismatch")');
38 shouldBeFalse('reportValidityFor("textarea")');
39 shouldBe('document.activeElement', '$("textarea")');
40 shouldBeTrue('reportValidityFor("select-no-explicit-value")');
41 shouldNotBe('document.activeElement', '$("select-no-explicit-value")');
42 shouldBeFalse('reportValidityFor("select-placeholder")');
43 shouldBe('document.activeElement', '$("select-placeholder")');
44 shouldBeTrue('reportValidityFor("select-non-placeholder")');
45 shouldNotBe('document.activeElement', '$("select-non-placeholder")');
46 </script>
47 </body>
48 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698