Index: LayoutTests/fast/forms/suggested-value-after-setvalue.html |
diff --git a/LayoutTests/fast/forms/suggested-value-after-setvalue.html b/LayoutTests/fast/forms/suggested-value-after-setvalue.html |
index f271d2956128b738599d6c81ff351a5670fc6a60..2e2e070f048048b579e2894474d2a3b1720cebd9 100644 |
--- a/LayoutTests/fast/forms/suggested-value-after-setvalue.html |
+++ b/LayoutTests/fast/forms/suggested-value-after-setvalue.html |
@@ -2,11 +2,17 @@ |
<html> |
<body> |
<p id="description">This test setting a value clears suggested value.</p> |
-<pre><input id="test" type="text" value="initial value"></pre> |
+<pre><input id="test" type="text" value="initial value"><br> |
+<textarea id="textarea"></textarea><br> |
+<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"; |
tkent
2014/06/09 01:01:13
nit: Use single-quotes for consistency.
|
+var select = document.getElementById('select'); |
+select.selectedIndex = -1; |
var result = document.getElementById('result'); |
if (!window.internals) |
testFailed('This test requires internals object'); |
@@ -15,6 +21,8 @@ else { |
input.selectionStart = input.selectionEnd = 0; |
internals.setSuggestedValue(input, 'suggested value'); |
+ internals.setSuggestedValue(textarea, 'suggested value'); |
+ internals.setSuggestedValue(select, 'TX'); |
Markup.description(document.getElementById('description').textContent) |
@@ -30,16 +38,36 @@ else { |
addTextResult('internals.suggestedValue(input)'); |
addTextResult('input.selectionStart'); |
addTextResult('input.selectionEnd'); |
+ addTextResult('textarea.value'); |
+ addTextResult('internals.suggestedValue(textarea)'); |
+ addTextResult('select.value'); |
+ addTextResult('internals.suggestedValue(select)'); |
+ } |
+ |
+ function getSelectedValues(select) { |
+ var selectedValues = []; |
+ for (var i = 0; i < select.options.length; i++) { |
+ var option = select.options[i]; |
+ if (option.selected) |
+ selectedValues.push(option.value); |
+ } |
+ return selectedValues.join(','); |
} |
log(); |
Markup.dump(input.parentNode, 'After setting suggestedValue'); |
input.value = 'new value'; |
+ textarea.value = 'new value'; |
+ select.value = 'CA'; |
log(); |
var innerTextValue = internals.shadowRoot(input).firstChild.innerText; |
- addText(innerTextValue == 'new value' ? 'PASS' : 'FAIL'); |
+ var innerTextAreaValue = internals.shadowRoot(textarea).firstChild.innerText; |
+ var selectedValues = getSelectedValues(select); |
+ addText(innerTextValue == 'new value' && |
+ innerTextAreaValue == 'new value' && |
+ selectedValues == 'CA' ? 'PASS' : 'FAIL'); |
Markup.dump(input.parentNode, 'After setting value'); |
} |