commit-queue@webkit.org | 06c2613 | 2011-03-22 09:48:43 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
mark.lam@apple.com | 93720da | 2013-09-07 23:31:07 +0000 | [diff] [blame] | 3 | <script src="../../resources/js-test-pre.js"></script> |
commit-queue@webkit.org | 06c2613 | 2011-03-22 09:48:43 +0000 | [diff] [blame] | 4 | <script> |
| 5 | function countAutofilledElements() { |
| 6 | return document.querySelectorAll(':-webkit-autofill').length; |
| 7 | } |
| 8 | |
| 9 | function test() { |
rniwa@webkit.org | ea3cf92 | 2012-06-22 06:52:33 +0000 | [diff] [blame] | 10 | if (window.testRunner) { |
| 11 | testRunner.dumpAsText(); |
commit-queue@webkit.org | 06c2613 | 2011-03-22 09:48:43 +0000 | [diff] [blame] | 12 | } |
| 13 | |
| 14 | var field = document.getElementById('field'); |
commit-queue@webkit.org | d3b19280 | 2013-02-23 08:14:38 +0000 | [diff] [blame] | 15 | if (window.internals) { |
| 16 | window.internals.setAutofilled(field, true); |
commit-queue@webkit.org | 06c2613 | 2011-03-22 09:48:43 +0000 | [diff] [blame] | 17 | } else { |
| 18 | testFailed('This test requires a LayoutTestController.'); |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | shouldBe('countAutofilledElements()', '1'); |
| 23 | |
| 24 | var form = document.getElementById('form'); |
| 25 | form.reset(); |
| 26 | |
| 27 | shouldBe('countAutofilledElements()', '0'); |
| 28 | } |
| 29 | </script> |
| 30 | |
| 31 | <style> |
| 32 | #tf { |
| 33 | color: #FFFFFF; |
| 34 | background-color: #FFFFFF; |
| 35 | } |
| 36 | </style> |
| 37 | </head> |
| 38 | <body onload="test()"> |
| 39 | This tests that a field's autofilled state is reverted when the form is reset. It can only be run using DumpRenderTree.<br> |
| 40 | <form id="form"> |
| 41 | <input type="text" id="field" /> |
| 42 | </form> |
| 43 | <div id="console"></div> |
| 44 | </body> |
| 45 | </html> |