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

Unified Diff: LayoutTests/fast/forms/suggested-value.html

Issue 138433002: Add Autofill preview support for <select> input fields (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/forms/suggested-value.html
diff --git a/LayoutTests/fast/forms/suggested-value.html b/LayoutTests/fast/forms/suggested-value.html
index 988b515cde791f310871684a764910df34dad9a3..f253a9b321b43e48a63f6775955ef4d912132cc6 100644
--- a/LayoutTests/fast/forms/suggested-value.html
+++ b/LayoutTests/fast/forms/suggested-value.html
@@ -4,13 +4,15 @@
<p id="description">This test setting suggested values on an input element
and a textarea element. The dump below should have the "suggested value"
instead of "initial value".</p>
-<pre><input id="test" type="text" value="initial value"><textarea id="textarea"></textarea></pre>
+<pre><input id="test" type="text" value="initial value"><textarea id="textarea"></textarea><select id="select"><option>CA</option><option>TX</option></select></pre>
<script src="../../resources/dump-as-markup.js"></script>
<script>
var input = document.getElementById('test');
var textarea = document.getElementById('textarea');
textarea.value = "initial value";
+var select = document.getElementById('select');
+select.selectedIndex = -1;
var result = document.getElementById('result');
if (!window.internals)
testFailed('This test requires internals object');
@@ -20,6 +22,7 @@ else {
internals.setSuggestedValue(input, 'suggested value');
internals.setSuggestedValue(textarea, 'suggested value');
+ internals.setSuggestedValue(select, 'TX');
Markup.description(document.getElementById('description').textContent)
@@ -30,7 +33,16 @@ else {
addTextResult('input.selectionEnd');
addTextResult('textarea.value');
addTextResult('internals.suggestedValue(textarea)');
-
+ // The selected option value is overwritten by the suggested value.
+ // We make a copy of this selected optioin value as originalValue and
+ // recover it once preview is done. The selectedIndex of <select> is
+ // recovered at the same time. This is a workaround as it looks that
+ // changing the text in display of the select inevitably change the
+ // selected index, hence the value of the selected option.
+ addTextResult('select.value');
+ addTextResult('internals.originalValue(select)');
+ addTextResult('internals.suggestedValue(select)');
+
Markup.dump(input.parentNode);
}

Powered by Google App Engine
This is Rietveld 408576698