OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p id="description"></p> | 7 <p id="description"></p> |
8 <form method="get" id="happy_form"> | 8 <form method="get" id="happy_form"> |
9 <fieldset name="victim"></fieldset> | 9 <fieldset name="victim"></fieldset> |
10 <input name="victim" type="text" value="lorem ipsum"/> | 10 <input name="victim" type="text" value="lorem ipsum"/> |
11 <button name="victim">lorem ipsum</button> | 11 <button name="victim">lorem ipsum</button> |
12 <select name="victim"></select> | 12 <select name="victim"></select> |
13 <textarea name="victim"></textarea> | 13 <textarea name="victim"></textarea> |
14 <output name="victim"></output> | 14 <output name="victim"></output> |
15 <object name="victim"></object> | 15 <object name="victim"></object> |
16 <keygen name="victim"></keygen> | |
17 </form> | 16 </form> |
18 <form action="" id="soon_to_be_happy_form"> | 17 <form action="" id="soon_to_be_happy_form"> |
19 <select required="" id="soon_to_be_happy_select"> | 18 <select required="" id="soon_to_be_happy_select"> |
20 <option>abc</option> | 19 <option>abc</option> |
21 </select> | 20 </select> |
22 </form> | 21 </form> |
23 <div id="console"></div> | 22 <div id="console"></div> |
24 <script> | 23 <script> |
25 description("This test checks if reportValidity() returns correctly a true (mean
ing no error) result."); | 24 description("This test checks if reportValidity() returns correctly a true (mean
ing no error) result."); |
26 | 25 |
27 debug('Elements valid from the begining'); | 26 debug('Elements valid from the begining'); |
28 shouldBe('document.getElementsByTagName("fieldset")[0].reportValidity()', 'true'
); | 27 shouldBe('document.getElementsByTagName("fieldset")[0].reportValidity()', 'true'
); |
29 shouldBe('document.getElementsByTagName("input")[0].reportValidity()', 'true'); | 28 shouldBe('document.getElementsByTagName("input")[0].reportValidity()', 'true'); |
30 shouldBe('document.getElementsByTagName("button")[0].reportValidity()', 'true'); | 29 shouldBe('document.getElementsByTagName("button")[0].reportValidity()', 'true'); |
31 shouldBe('document.getElementsByTagName("select")[0].reportValidity()', 'true'); | 30 shouldBe('document.getElementsByTagName("select")[0].reportValidity()', 'true'); |
32 shouldBe('document.getElementsByTagName("textarea")[0].reportValidity()', 'true'
); | 31 shouldBe('document.getElementsByTagName("textarea")[0].reportValidity()', 'true'
); |
33 shouldBe('document.getElementsByTagName("output")[0].reportValidity()', 'true'); | 32 shouldBe('document.getElementsByTagName("output")[0].reportValidity()', 'true'); |
34 shouldBe('document.getElementsByTagName("object")[0].reportValidity()', 'true'); | 33 shouldBe('document.getElementsByTagName("object")[0].reportValidity()', 'true'); |
35 shouldBe('document.getElementsByTagName("keygen")[0].reportValidity()', 'true'); | |
36 shouldBe('document.getElementById("happy_form")[0].reportValidity()', 'true'); | 34 shouldBe('document.getElementById("happy_form")[0].reportValidity()', 'true'); |
37 debug(''); | 35 debug(''); |
38 | 36 |
39 debug('Element valid when changed'); | 37 debug('Element valid when changed'); |
40 jsTestIsAsync = true; | 38 jsTestIsAsync = true; |
41 var form = document.getElementById('soon_to_be_happy_form'); | 39 var form = document.getElementById('soon_to_be_happy_form'); |
42 var select = document.getElementById('soon_to_be_happy_select'); | 40 var select = document.getElementById('soon_to_be_happy_select'); |
43 form.onchange = function() { | 41 form.onchange = function() { |
44 shouldBeTrue('form.reportValidity()'); | 42 shouldBeTrue('form.reportValidity()'); |
45 debug(''); | 43 debug(''); |
46 finishJSTest(); | 44 finishJSTest(); |
47 }; | 45 }; |
48 window.onload = function() { | 46 window.onload = function() { |
49 select.value = null; | 47 select.value = null; |
50 select.focus(); | 48 select.focus(); |
51 if (window.eventSender) | 49 if (window.eventSender) |
52 eventSender.keyDown('a'); | 50 eventSender.keyDown('a'); |
53 }; | 51 }; |
54 | 52 |
55 </script> | 53 </script> |
56 </body> | 54 </body> |
57 </html> | 55 </html> |
OLD | NEW |