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

Side by Side Diff: LayoutTests/fast/forms/resources/common-setrangetext.js

Issue 596723002: Enabling selection API for input type=<file, color, date, email, number> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Enabling Selection API for input type email and number Created 6 years, 3 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
OLDNEW
1 function runTestsShouldPass(tagName, attributes) 1 function runTestsShouldPass(tagName, attributes)
2 { 2 {
3 attributes = attributes || {}; 3 attributes = attributes || {};
4 window.element = document.createElement(tagName); 4 window.element = document.createElement(tagName);
5 for (var key in attributes) 5 for (var key in attributes)
6 element.setAttribute(key, attributes[key]); 6 element.setAttribute(key, attributes[key]);
7 document.body.appendChild(element); 7 document.body.appendChild(element);
8 debug("<hr>"); 8 debug("<hr>");
9 debug("Running tests on " + tagName + " with attributes: " + JSON.stringify( attributes) + "\n"); 9 debug("Running tests on " + tagName + " with attributes: " + JSON.stringify( attributes) + "\n");
10 debug("setRangeText() with only one parameter."); 10 debug("setRangeText() with only one parameter.");
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (element.getAttribute("type") == "file") 155 if (element.getAttribute("type") == "file")
156 shouldThrow("element.value = '0123456789XYZ'"); 156 shouldThrow("element.value = '0123456789XYZ'");
157 else 157 else
158 evalAndLog("element.value = '0123456789XYZ'"); 158 evalAndLog("element.value = '0123456789XYZ'");
159 var initialValue = element.value; 159 var initialValue = element.value;
160 shouldThrow("element.setRangeText('ABC', 0, 0)"); 160 shouldThrow("element.setRangeText('ABC', 0, 0)");
161 // setRangeText() shouldn't do anything on non-text form controls. 161 // setRangeText() shouldn't do anything on non-text form controls.
162 shouldBeEqualToString("element.value", initialValue); 162 shouldBeEqualToString("element.value", initialValue);
163 } 163 }
164 164
165 function runTestsShouldNotThrow(tagName, attributes)
166 {
167 attributes = attributes || {};
168 window.element = document.createElement(tagName);
169 for (var key in attributes)
170 element.setAttribute(key, attributes[key]);
165 171
172 document.body.appendChild(element);
173 debug("<hr>");
174 debug("Running tests on " + tagName + " with attributes: " + JSON.stringify( attributes) + "\n");
175
176 var initialValue = element.value;
177 if (element.getAttribute("type") == "file")
178 shouldThrow("element.value = '0123456789'");
179 else
180 evalAndLog("element.value = '0123456789'");
181 evalAndLog("element.setSelectionRange(2, 5)");
182 evalAndLog("element.setRangeText('432')");
183
184 // setRangeText() shouldn't do anything on non-text form controls.
185 if (element.getAttribute("type") == "color")
186 shouldBeEqualToString("element.value", "#000000");
187 else
188 shouldBeEqualToString("element.value", initialValue);
189 shouldNotBe("element.value", "0143256789");
190 }
191
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/number/number-setrangetext-expected.txt ('k') | LayoutTests/fast/forms/selection-wrongtype.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698