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); |
} |