OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 <script> | 4 <script> |
5 window.jsTestIsAsync = true; | |
tkent
2014/01/14 00:35:33
Why?
sof
2014/01/14 06:39:48
To address the test previously dumping out "TEST C
tkent
2014/01/14 06:58:34
Oh, I see.
It seems we don't need to run test() i
| |
5 function test() { | 6 function test() { |
6 var form = document.getElementById('form'); | 7 var form = document.getElementById('form'); |
7 var field = document.getElementById('field'); | 8 var field = document.getElementById('field'); |
8 | 9 |
9 shouldBeTrue("('autocomplete' in form)"); | 10 shouldBeTrue("('autocomplete' in form)"); |
10 shouldBeTrue("('autocomplete' in field)"); | 11 shouldBeTrue("('autocomplete' in field)"); |
11 | 12 |
12 shouldBeNull("form.getAttribute('autocomplete')"); | 13 shouldBeNull("form.getAttribute('autocomplete')"); |
13 shouldBeNull("field.getAttribute('autocomplete')"); | 14 shouldBeNull("field.getAttribute('autocomplete')"); |
14 | 15 |
15 shouldBeEqualToString("form.autocomplete", ""); | 16 shouldBeEqualToString("form.autocomplete", "on"); |
16 shouldBeEqualToString("field.autocomplete", ""); | 17 shouldBeEqualToString("field.autocomplete", ""); |
17 | 18 |
18 form.autocomplete = 'off'; | 19 shouldBeEqualToString("form.autocomplete = 'off'; form.getAttribute('aut ocomplete')", "off"); |
19 field.autocomplete = 'off'; | 20 shouldBeEqualToString("field.autocomplete = 'off'; field.getAttribute('a utocomplete')", "off"); |
20 shouldBeEqualToString("form.getAttribute('autocomplete')", "off"); | 21 shouldBeEqualToString("form.setAttribute('autocomplete', 'on'); form.aut ocomplete", "on"); |
21 shouldBeEqualToString("field.getAttribute('autocomplete')", "off"); | 22 shouldBeEqualToString("field.setAttribute('autocomplete', 'on'); field.a utocomplete", "on"); |
22 | 23 shouldBeEqualToString("form.setAttribute('autocomplete', 'indeterminate' ); form.autocomplete", "on"); |
23 form.setAttribute('autocomplete', 'on'); | 24 shouldBeEqualToString("field.setAttribute('autocomplete', 'indeterminate '); field.autocomplete", "indeterminate"); |
24 field.setAttribute('autocomplete', 'on'); | 25 finishJSTest(); |
25 shouldBeEqualToString("form.autocomplete", "on"); | |
26 shouldBeEqualToString("field.autocomplete", "on"); | |
27 } | 26 } |
28 </script> | 27 </script> |
29 </head> | 28 </head> |
30 <body onload="test()"> | 29 <body onload="test()"> |
31 This tests that the 'autocomplete' attribute of form and input elements is b ound to a JavaScript property. | 30 This tests that the 'autocomplete' attribute of form and input elements is b ound to a JavaScript property. |
32 <form id="form"> | 31 <form id="form"> |
33 <input type="text" id="field" /> | 32 <input type="text" id="field" /> |
34 </form> | 33 </form> |
35 <div id="console"></div> | 34 <div id="console"></div> |
36 </body> | 35 </body> |
37 </html> | 36 </html> |
OLD | NEW |