Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: LayoutTests/fast/forms/autofilled.html

Issue 613213002: [Patch resubmit]: Turn off autofill highlight when changing option in an autofilled <select> element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update code as per review comments. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/forms/autofilled-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <head> 1 <head>
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <script src="resources/common.js"></script> 3 <script src="resources/common.js"></script>
4 <script> 4 <script>
5 5
6 function backgroundOf(element) { 6 function backgroundOf(element) {
7 return document.defaultView.getComputedStyle(element, null).getPropertyValue ('background-color'); 7 return document.defaultView.getComputedStyle(element, null).getPropertyValue ('background-color');
8 } 8 }
9 9
10 function foregroundOf(element) { 10 function foregroundOf(element) {
(...skipping 12 matching lines...) Expand all
23 return; 23 return;
24 } 24 }
25 25
26 var field = document.getElementById('field'); 26 var field = document.getElementById('field');
27 var search = document.getElementById('search'); 27 var search = document.getElementById('search');
28 var textarea1 = document.getElementById('textarea1'); 28 var textarea1 = document.getElementById('textarea1');
29 var textarea2 = document.getElementById('textarea2'); 29 var textarea2 = document.getElementById('textarea2');
30 textarea2.value = 'autofilled is true'; 30 textarea2.value = 'autofilled is true';
31 var select1 = document.getElementById('select1'); 31 var select1 = document.getElementById('select1');
32 select2 = document.getElementById('select2'); 32 select2 = document.getElementById('select2');
33 var select3 = document.getElementById('select3');
33 34
34 shouldBe('foregroundOf(textarea1)', 'originalForeground'); 35 shouldBe('foregroundOf(textarea1)', 'originalForeground');
35 shouldBe('backgroundOf(textarea1)', 'originalBackground'); 36 shouldBe('backgroundOf(textarea1)', 'originalBackground');
36 37
37 window.internals.setAutofilled(field, true); 38 window.internals.setAutofilled(field, true);
38 window.internals.setAutofilled(search, true); 39 window.internals.setAutofilled(search, true);
39 window.internals.setAutofilled(textarea1, true); 40 window.internals.setAutofilled(textarea1, true);
40 window.internals.setAutofilled(textarea2, true); 41 window.internals.setAutofilled(textarea2, true);
41 window.internals.setAutofilled(select1, true); 42 window.internals.setAutofilled(select1, true);
42 window.internals.setAutofilled(select2, true); 43 window.internals.setAutofilled(select2, true);
44 window.internals.setAutofilled(select3, true);
43 45
44 shouldBeEqualToString('search.value', 'Search value'); 46 shouldBeEqualToString('search.value', 'Search value');
45 47
46 // Both the foreground and background colors should change. 48 // Both the foreground and background colors should change.
47 shouldNotBe('foregroundOf(field)', 'originalForeground'); 49 shouldNotBe('foregroundOf(field)', 'originalForeground');
48 shouldNotBe('backgroundOf(field)', 'originalBackground'); 50 shouldNotBe('backgroundOf(field)', 'originalBackground');
49 shouldNotBe('foregroundOf(search)', 'originalForeground'); 51 shouldNotBe('foregroundOf(search)', 'originalForeground');
50 shouldNotBe('backgroundOf(search)', 'originalBackground'); 52 shouldNotBe('backgroundOf(search)', 'originalBackground');
51 shouldNotBe('foregroundOf(textarea1)', 'originalForeground'); 53 shouldNotBe('foregroundOf(textarea1)', 'originalForeground');
52 shouldNotBe('backgroundOf(textarea1)', 'originalBackground'); 54 shouldNotBe('backgroundOf(textarea1)', 'originalBackground');
53 shouldNotBe('foregroundOf(textarea2)', 'originalForeground'); 55 shouldNotBe('foregroundOf(textarea2)', 'originalForeground');
54 shouldNotBe('backgroundOf(textarea2)', 'originalBackground'); 56 shouldNotBe('backgroundOf(textarea2)', 'originalBackground');
55 shouldNotBe('foregroundOf(select1)', 'originalForeground'); 57 shouldNotBe('foregroundOf(select1)', 'originalForeground');
56 shouldNotBe('backgroundOf(select1)', 'originalBackground'); 58 shouldNotBe('backgroundOf(select1)', 'originalBackground');
57 shouldNotBe('foregroundOf(select2)', 'originalForeground'); 59 shouldNotBe('foregroundOf(select2)', 'originalForeground');
58 shouldNotBe('backgroundOf(select2)', 'originalBackground'); 60 shouldNotBe('backgroundOf(select2)', 'originalBackground');
61 shouldNotBe('foregroundOf(select3)', 'originalForeground');
62 shouldNotBe('backgroundOf(select3)', 'originalBackground');
59 63
60 // Remove an unselected option from <select> element. This should not affect the background color for the autofilled <select> element. 64 // Remove an unselected option from <select> element. This should not affect the background color for the autofilled <select> element.
61 shouldBe('select2.options.length', '3'); 65 shouldBe('select2.options.length', '3');
62 select2.removeChild(select2.childNodes[1]); 66 select2.removeChild(select2.childNodes[1]);
63 shouldBe('select2.options.length', '2'); 67 shouldBe('select2.options.length', '2');
64 autofilledSelectForeground = foregroundOf(select2); 68 autofilledSelectForeground = foregroundOf(select2);
65 autofilledSelectBackground = backgroundOf(select2); 69 autofilledSelectBackground = backgroundOf(select2);
66 shouldBe('foregroundOf(select2)', 'autofilledSelectForeground'); 70 shouldBe('foregroundOf(select2)', 'autofilledSelectForeground');
67 shouldBe('backgroundOf(select2)', 'autofilledSelectBackground'); 71 shouldBe('backgroundOf(select2)', 'autofilledSelectBackground');
68 72
(...skipping 12 matching lines...) Expand all
81 textarea2.focus(); 85 textarea2.focus();
82 document.execCommand('Delete', false, null); 86 document.execCommand('Delete', false, null);
83 document.execCommand('Delete', false, null); 87 document.execCommand('Delete', false, null);
84 document.execCommand('Delete', false, null); 88 document.execCommand('Delete', false, null);
85 document.execCommand('Delete', false, null); 89 document.execCommand('Delete', false, null);
86 document.execCommand('InsertText', false, 'false'); 90 document.execCommand('InsertText', false, 'false');
87 91
88 // Remove selected option for select2 element 92 // Remove selected option for select2 element
89 select2.removeChild(select2[select2.selectedIndex]); 93 select2.removeChild(select2[select2.selectedIndex]);
90 94
95 // Change selected option for select3 element
96 select3.selectedIndex = 2;
97
91 // Colors should be restored. 98 // Colors should be restored.
92 shouldBe('foregroundOf(field)', 'originalForeground'); 99 shouldBe('foregroundOf(field)', 'originalForeground');
93 shouldBe('backgroundOf(field)', 'originalBackground'); 100 shouldBe('backgroundOf(field)', 'originalBackground');
94 shouldBe('foregroundOf(search)', 'originalForeground'); 101 shouldBe('foregroundOf(search)', 'originalForeground');
95 shouldBe('backgroundOf(search)', 'originalBackground'); 102 shouldBe('backgroundOf(search)', 'originalBackground');
96 shouldBe('foregroundOf(textarea1)', 'originalForeground'); 103 shouldBe('foregroundOf(textarea1)', 'originalForeground');
97 shouldBe('backgroundOf(textarea1)', 'originalBackground'); 104 shouldBe('backgroundOf(textarea1)', 'originalBackground');
98 shouldBe('foregroundOf(textarea2)', 'originalForeground'); 105 shouldBe('foregroundOf(textarea2)', 'originalForeground');
99 shouldBe('backgroundOf(textarea2)', 'originalBackground'); 106 shouldBe('backgroundOf(textarea2)', 'originalBackground');
100 shouldBe('foregroundOf(select1)', 'originalForeground'); 107 shouldBe('foregroundOf(select1)', 'originalForeground');
101 shouldBe('backgroundOf(select1)', 'originalBackground'); 108 shouldBe('backgroundOf(select1)', 'originalBackground');
102 shouldBe('foregroundOf(select2)', 'originalForeground'); 109 shouldBe('foregroundOf(select2)', 'originalForeground');
103 shouldBe('backgroundOf(select2)', 'originalBackground'); 110 shouldBe('backgroundOf(select2)', 'originalBackground');
111 shouldBe('foregroundOf(select3)', 'originalForeground');
112 shouldBe('backgroundOf(select3)', 'originalBackground');
104 } 113 }
105 </script> 114 </script>
106 115
107 <style> 116 <style>
108 #field, #search, #textarea1, #textarea2, #select1, #select2 { 117 #field, #search, #textarea1, #textarea2, #select1, #select2, #select3 {
109 color: #FFFFFF; 118 color: #FFFFFF;
110 background-color: #FFFFFF; 119 background-color: #FFFFFF;
111 } 120 }
112 </style> 121 </style>
113 </head> 122 </head>
114 <body onload="test()"> 123 <body onload="test()">
115 This tests that foreground and background colors properly change for autofil led inputs or select options. It can only be run using the test harness.<br> 124 This tests that foreground and background colors properly change for autofil led inputs or select options. It can only be run using the test harness.<br>
116 <form name="fm"> 125 <form name="fm">
117 <input type="text" id="field" value="Field value"> 126 <input type="text" id="field" value="Field value">
118 <input type="search" id="search" value="Search value"> 127 <input type="search" id="search" value="Search value">
119 <textarea id="textarea1"></textarea> 128 <textarea id="textarea1"></textarea>
120 <textarea id="textarea2"></textarea> 129 <textarea id="textarea2"></textarea>
121 <select id="select1"></select> 130 <select id="select1"></select>
122 <select id="select2"> 131 <select id="select2">
123 <option selected>1</option> 132 <option selected>1</option>
124 <option >2</option> 133 <option >2</option>
125 <option>3</option> 134 <option>3</option>
126 </select> 135 </select>
136 <select id="select3">
137 <option selected>1</option>
138 <option >2</option>
139 <option>3</option>
140 </select>
127 </form> 141 </form>
128 <div id="console"></div> 142 <div id="console"></div>
129 </body> 143 </body>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/forms/autofilled-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698