| OLD | NEW |
| 1 <html> | |
| 2 <head> | 1 <head> |
| 3 <script src="../js/resources/js-test-pre.js"></script> | 2 <script src="../js/resources/js-test-pre.js"></script> |
| 4 <script> | 3 <script> |
| 5 function countAutofilledElements() { | 4 function countAutofilledElements() { |
| 6 return document.querySelectorAll(':-webkit-autofill').length; | 5 return document.querySelectorAll(':-webkit-autofill').length; |
| 7 } | 6 } |
| 8 | 7 |
| 9 function test() { | 8 function test() { |
| 10 if (window.testRunner) { | 9 if (window.testRunner) { |
| 11 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
| 12 } | 11 } |
| 13 | 12 |
| 14 var field = document.getElementById('field'); | 13 var field = document.getElementById('field'); |
| 14 var select = document.getElementById('select'); |
| 15 var textarea = document.getElementById('textarea'); |
| 15 if (window.internals) { | 16 if (window.internals) { |
| 16 window.internals.setAutofilled(field, true); | 17 window.internals.setAutofilled(field, true); |
| 18 window.internals.setAutofilled(select, true); |
| 19 window.internals.setAutofilled(textarea, true); |
| 17 } else { | 20 } else { |
| 18 testFailed('This test requires a LayoutTestController.'); | 21 testFailed('This test requires a LayoutTestController.'); |
| 19 return; | 22 return; |
| 20 } | 23 } |
| 21 | 24 |
| 22 shouldBe('countAutofilledElements()', '1'); | 25 shouldBe('countAutofilledElements()', '3'); |
| 23 | 26 |
| 24 var form = document.getElementById('form'); | 27 var form = document.getElementById('form'); |
| 25 form.reset(); | 28 form.reset(); |
| 26 | 29 |
| 27 shouldBe('countAutofilledElements()', '0'); | 30 shouldBe('countAutofilledElements()', '0'); |
| 28 } | 31 } |
| 29 </script> | 32 </script> |
| 30 | 33 |
| 31 <style> | 34 <style> |
| 32 #tf { | 35 #tf { |
| 33 color: #FFFFFF; | 36 color: #FFFFFF; |
| 34 background-color: #FFFFFF; | 37 background-color: #FFFFFF; |
| 35 } | 38 } |
| 36 </style> | 39 </style> |
| 37 </head> | 40 </head> |
| 38 <body onload="test()"> | 41 <body onload="test()"> |
| 39 This tests that a field's autofilled state is reverted when the form is rese
t. It can only be run using DumpRenderTree.<br> | 42 This tests that a field's autofilled state is reverted when the form is rese
t. It can only be run using the test harness.<br> |
| 40 <form id="form"> | 43 <form id="form"> |
| 41 <input type="text" id="field" /> | 44 <input type="text" id="field"> |
| 45 <select id="select"></select> |
| 46 <textarea id="textarea"></textarea> |
| 42 </form> | 47 </form> |
| 43 <div id="console"></div> | 48 <div id="console"></div> |
| 44 </body> | 49 </body> |
| 45 </html> | |
| OLD | NEW |