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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/forms/the-input-element/input-textselection-01.html

Issue 1144143009: W3C Test: Import web-platform-tests/html/semantics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <title>The selection interface members</title>
3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#textFieldSelectio n">
5 <script src="../../../../../../resources/testharness.js"></script>
6 <script src="../../../../../../resources/testharnessreport.js"></script>
7 <div id="log"></div>
8 <script>
9 test(function() {
10 var valid = ["text", "search", "url", "tel", "email", "password"];
11 var invalid = ["hidden", "datetime", "date", "month", "week", "datetime-local" ,
12 "number", "range", "color", "checkbox", "radio", "button",
13 "file", "submit", "image", "reset"];
14 valid.forEach(function(aType) {
15 test(function() {
16 var input = document.createElement("input");
17 input.type = aType;
18 assert_equals(input.type, aType, "Input type unsupported")
19 input.select();
20 var a = input.selectionStart;
21 input.selectionStart = 0;
22 a = input.selectionEnd;
23 input.selectionEnd = 0;
24 input.setSelectionRange(0, 0);
25 }, "Selection attributes should apply to type " + aType)
26 })
27
28 invalid.forEach(function(aType) {
29 test(function() {
30 var input = document.createElement("input");
31 input.type = aType;
32 assert_equals(input.type, aType, "Input type unsupported")
33 assert_throws("INVALID_STATE_ERR", function() { input.select(); }, "Should throw with type " + aType);
34 assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionSta rt; });
35 assert_throws("INVALID_STATE_ERR", function() { input.selectionStart = 0; });
36 assert_throws("INVALID_STATE_ERR", function() { var a = input.selectionEnd ; });
37 assert_throws("INVALID_STATE_ERR", function() { input.selectionEnd = 0; }) ;
38 assert_throws("INVALID_STATE_ERR", function() { input.setSelectionRange(0, 0); });
39 }, "Selection attributes should not apply to type " + aType)
40 })
41 });
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698