summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/forms/textfieldselection/selection-not-application.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/semantics/forms/textfieldselection/selection-not-application.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/semantics/forms/textfieldselection/selection-not-application.html')
-rw-r--r--testing/web-platform/tests/html/semantics/forms/textfieldselection/selection-not-application.html48
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/forms/textfieldselection/selection-not-application.html b/testing/web-platform/tests/html/semantics/forms/textfieldselection/selection-not-application.html
new file mode 100644
index 000000000..576e6d125
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/forms/textfieldselection/selection-not-application.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>text field selection</title>
+<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
+<link rel=help href="https://html.spec.whatwg.org/multipage/#textFieldSelection">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+ var types = ["hidden", "email", "datetime-local", "date", "month", "week", "time", "number", "range", "color", "checkbox", "radio", "file", "submit", "image", "reset", "button"]; //types for which the API doesn't apply
+ var types2 = ["text", "search", "tel", "url", "password"]; //types for which the API applies
+
+ types.forEach(function(type){
+ test(function(){
+ var el = document.createElement("input");
+ el.type = type;
+ assert_throws("InvalidStateError", function(){
+ el.selectionStart;
+ });
+ assert_throws("InvalidStateError", function(){
+ el.selectionEnd;
+ });
+ assert_throws("InvalidStateError", function(){
+ el.selectionDirection;
+ });
+ assert_throws("InvalidStateError", function(){
+ el.setRangeText("foobar");
+ });
+ assert_throws("InvalidStateError", function(){
+ el.setSelectionRange(0, 1);
+ });
+ }, "text field selection for the input " + type);
+ });
+
+ types2.forEach(function(type) {
+ test(function() {
+ var el = document.createElement("input");
+ el.type = type;
+ assert_equals(el.selectionStart, 0);
+ assert_equals(el.selectionEnd, 0);
+ el.selectionStart = 1;
+ el.selectionEnd = 1;
+ el.selectionDirection = "forward";
+ el.setRangeText("foobar");
+ el.setSelectionRange(0, 1);
+ }, "text field selection for the input " + type);
+ });
+</script>