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

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

Issue 319443003: Clear the suggested value while setting value for <select> element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update test file as per Ilya's review comments. Created 6 years, 6 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/suggested-value-after-setvalue-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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');
}
« no previous file with comments | « no previous file | LayoutTests/fast/forms/suggested-value-after-setvalue-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698