OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
2 <html> | |
3 <head> | |
4 <script src="../../resources/js-test.js"></script> | |
5 <style> | |
6 :focus { background: rgb(0, 255, 0); } | |
7 :not(:focus) { background: rgb(255, 0, 0); } | |
8 </style> | |
9 </head> | |
10 <body> | |
11 <p id="description"></p> | |
12 <form method="get" id="sad_form"> | |
13 <fieldset name="victim"> | |
14 <input id="input-unset" name="victim" type="text" required/> | |
15 </fieldset> | |
16 <input name="victim" type="text" value="invalid" pattern="something"/> | |
17 <button name="victim">lorem ipsum</button> | |
18 <textarea name="victim" required></textarea> | |
19 <select required> | |
20 <option>empty</option> | |
21 <option>another</option> | |
22 </select> | |
23 <select name="victim" required> | |
24 <option value="" selected /> | |
25 <option value="X">X</option> | |
26 </select> | |
27 <select name="victim" required> | |
28 <option value="X">X</option> | |
29 <option value="" selected /> | |
30 </select> | |
31 </form> | |
32 <div id="console"></div> | |
33 <script> | |
34 function backgroundOf(id) { | |
35 return document.defaultView.getComputedStyle(document.getElementById(id), nu ll).getPropertyValue('background-color'); | |
36 } | |
37 var unfocusedColor = 'rgb(255, 0, 0)'; | |
38 var focusedColor = 'rgb(0, 255, 0)'; | |
39 | |
40 description("This test checks if reportValidity() returns correctly a false (mea ning there's an invalid element) result on form element."); | |
41 | |
42 f = document.getElementById("sad_form"); | |
43 shouldBe("f.reportValidity()", "false"); | |
44 shouldBe("backgroundOf('input-unset')", "focusedColor"); | |
keishi
2014/10/21 08:20:14
We can use document.activeElement to check if the
Bartek Nowierski
2014/10/21 11:03:52
Done.
| |
45 </script> | |
46 </body> | |
47 </html> | |
OLD | NEW |