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

Side by Side Diff: third_party/WebKit/LayoutTests/editing/selection/collapseto_in_text_fields.html

Issue 2877793003: Merge "Selection API: collapseToStart() and collapseToEnd() should work for text fields." to M59 (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/DOMSelection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <title>Tests for crbug.com/716725</title>
3 <body>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6
7 <input value="abcdef">
8 <textarea>abcdef</textarea>
9
10 <script>
11 function testCollapseToStart(element) {
12 test(() => {
13 element.focus();
14 element.setSelectionRange(1, 5);
15 getSelection().collapseToStart();
16 assert_equals(element.selectionStart, 1);
17 assert_equals(element.selectionEnd, 1);
18 }, 'Selection.collapseToStart() should collapse text selection in ' + element. tagName);
19 }
20
21 function testCollapseToEnd(element) {
22 test(() => {
23 element.focus();
24 element.setSelectionRange(1, 5);
25 getSelection().collapseToEnd();
26 assert_equals(element.selectionStart, 5);
27 assert_equals(element.selectionEnd, 5);
28 }, 'Selection.collapseToEnd() should collapse text selection in ' + element.ta gName);
29 }
30
31 testCollapseToStart(document.querySelector('input'));
32 testCollapseToStart(document.querySelector('textarea'));
33 testCollapseToEnd(document.querySelector('input'));
34 testCollapseToEnd(document.querySelector('textarea'));
35 </script>
36 </body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/DOMSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698