blob: ffe78249d1d01b70d5b91fe7011589e4d5e3e79f [file] [log] [blame]
commit-queue@webkit.org06c26132011-03-22 09:48:43 +00001<html>
2<head>
mark.lam@apple.com93720da2013-09-07 23:31:07 +00003 <script src="../../resources/js-test-pre.js"></script>
commit-queue@webkit.org06c26132011-03-22 09:48:43 +00004 <script>
5 function countAutofilledElements() {
6 return document.querySelectorAll(':-webkit-autofill').length;
7 }
8
9 function test() {
rniwa@webkit.orgea3cf922012-06-22 06:52:33 +000010 if (window.testRunner) {
11 testRunner.dumpAsText();
commit-queue@webkit.org06c26132011-03-22 09:48:43 +000012 }
13
14 var field = document.getElementById('field');
commit-queue@webkit.orgd3b192802013-02-23 08:14:38 +000015 if (window.internals) {
16 window.internals.setAutofilled(field, true);
commit-queue@webkit.org06c26132011-03-22 09:48:43 +000017 } 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>