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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/DOMSelection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/selection/collapseto_in_text_fields.html
diff --git a/third_party/WebKit/LayoutTests/editing/selection/collapseto_in_text_fields.html b/third_party/WebKit/LayoutTests/editing/selection/collapseto_in_text_fields.html
new file mode 100644
index 0000000000000000000000000000000000000000..5e2cbab69988923b3e5d0a8528d4f19eeec7a28d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/selection/collapseto_in_text_fields.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<title>Tests for crbug.com/716725</title>
+<body>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<input value="abcdef">
+<textarea>abcdef</textarea>
+
+<script>
+function testCollapseToStart(element) {
+ test(() => {
+ element.focus();
+ element.setSelectionRange(1, 5);
+ getSelection().collapseToStart();
+ assert_equals(element.selectionStart, 1);
+ assert_equals(element.selectionEnd, 1);
+ }, 'Selection.collapseToStart() should collapse text selection in ' + element.tagName);
+}
+
+function testCollapseToEnd(element) {
+ test(() => {
+ element.focus();
+ element.setSelectionRange(1, 5);
+ getSelection().collapseToEnd();
+ assert_equals(element.selectionStart, 5);
+ assert_equals(element.selectionEnd, 5);
+ }, 'Selection.collapseToEnd() should collapse text selection in ' + element.tagName);
+}
+
+testCollapseToStart(document.querySelector('input'));
+testCollapseToStart(document.querySelector('textarea'));
+testCollapseToEnd(document.querySelector('input'));
+testCollapseToEnd(document.querySelector('textarea'));
+</script>
+</body>
« 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