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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/forms/resources/common-setrangetext.js
diff --git a/LayoutTests/fast/forms/resources/common-setrangetext.js b/LayoutTests/fast/forms/resources/common-setrangetext.js
index 6861347fab84f8211e1f9e7f54e47b0ab9bbacd6..cbc3b54a897e872348eb46a27def00988544ec9b 100644
--- a/LayoutTests/fast/forms/resources/common-setrangetext.js
+++ b/LayoutTests/fast/forms/resources/common-setrangetext.js
@@ -162,4 +162,30 @@ function runTestsShouldFail(tagName, attributes)
shouldBeEqualToString("element.value", initialValue);
}
+function runTestsShouldNotThrow(tagName, attributes)
+{
+ attributes = attributes || {};
+ window.element = document.createElement(tagName);
+ for (var key in attributes)
+ element.setAttribute(key, attributes[key]);
+
+ document.body.appendChild(element);
+ debug("<hr>");
+ debug("Running tests on " + tagName + " with attributes: " + JSON.stringify(attributes) + "\n");
+
+ var initialValue = element.value;
+ if (element.getAttribute("type") == "file")
+ shouldThrow("element.value = '0123456789'");
+ else
+ evalAndLog("element.value = '0123456789'");
+ evalAndLog("element.setSelectionRange(2, 5)");
+ evalAndLog("element.setRangeText('432')");
+
+ // setRangeText() shouldn't do anything on non-text form controls.
+ if (element.getAttribute("type") == "color")
+ shouldBeEqualToString("element.value", "#000000");
+ else
+ shouldBeEqualToString("element.value", initialValue);
+ shouldNotBe("element.value", "0143256789");
+}
« 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