Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / reset-autofilled.html
blob7511385fbc9ebe87269fcdcb41b28b4f47c1812d
1 <head>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4 function countAutofilledElements() {
5 return document.querySelectorAll(':-webkit-autofill').length;
8 function test() {
9 if (window.testRunner) {
10 testRunner.dumpAsText();
13 var field = document.getElementById('field');
14 var select = document.getElementById('select');
15 var textarea = document.getElementById('textarea');
16 if (window.internals) {
17 window.internals.setAutofilled(field, true);
18 window.internals.setAutofilled(select, true);
19 window.internals.setAutofilled(textarea, true);
20 } else {
21 testFailed('This test requires a LayoutTestController.');
22 return;
25 shouldBe('countAutofilledElements()', '3');
27 var form = document.getElementById('form');
28 form.reset();
30 shouldBe('countAutofilledElements()', '0');
32 </script>
34 <style>
35 #tf {
36 color: #FFFFFF;
37 background-color: #FFFFFF;
39 </style>
40 </head>
41 <body onload="test()">
42 This tests that a field's autofilled state is reverted when the form is reset. It can only be run using the test harness.<br>
43 <form id="form">
44 <input type="text" id="field">
45 <select id="select"></select>
46 <textarea id="textarea"></textarea>
47 </form>
48 <div id="console"></div>
49 </body>