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

Unified Diff: LayoutTests/editing/selection/select-down-or-up-the-lines-in-readonly-texts-using-keys-with-caret-mode-off.html

Issue 268993002: For non-editable content, selection editor commands are disabled Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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/editing/selection/select-down-or-up-the-lines-in-readonly-texts-using-keys-with-caret-mode-off.html
diff --git a/LayoutTests/editing/selection/select-down-or-up-the-lines-in-readonly-texts-using-keys-with-caret-mode-off.html b/LayoutTests/editing/selection/select-down-or-up-the-lines-in-readonly-texts-using-keys-with-caret-mode-off.html
new file mode 100644
index 0000000000000000000000000000000000000000..1210f306847542ffa7fb6ffbfc61d561868c9ef9
--- /dev/null
+++ b/LayoutTests/editing/selection/select-down-or-up-the-lines-in-readonly-texts-using-keys-with-caret-mode-off.html
@@ -0,0 +1,47 @@
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<div id="target" contenteditable="false"><p>This is the first paragraph.</p><p>This is the second paragraph.</p>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This tests selection in readonly texts using shift+Up/Down. With this key combination you can select up or down the line. When no further up/down movement is possible, the selection either moves to the start (for up) or end (for down) of the line.")
+ if (window.testRunner) {
+ testRunner.overridePreference("WebKitEnableCaretBrowsing", false);
+ testRunner.dumpAsText();
+ }
+
+ var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
+
+ var target = document.getElementById('target');
+ var selection = window.getSelection();
+ var range = document.createRange();
+ range.setStart(target.firstChild.firstChild, 3);
+ selection.addRange(range);
+ target.focus();
+ var paragraph1 = target.firstChild.firstChild;
+ var paragraph2 = target.childNodes[1].firstChild;
+
+ // check up/down arrows + Shift
+ if (window.eventSender) {
+ eventSender.keyDown("upArrow", ["shiftKey"]);
+ shouldBeEqualToString("selection.type", "Range");
+ shouldBe("selection.anchorNode", "paragraph1");
+ shouldBe("selection.anchorOffset", "3");
+ shouldBe("selection.focusNode", "paragraph1");
+ shouldBe("selection.focusOffset", "0");
+ eventSender.keyDown("downArrow", ["shiftKey"]);
+ if (onMacPlatform)
+ eventSender.keyDown("downArrow", ["shiftKey"]);
+ shouldBeEqualToString("selection.type", "Range");
+ shouldBe("selection.anchorNode", "paragraph1");
+ shouldBe("selection.anchorOffset", "3");
+ shouldBe("selection.focusNode", "paragraph2");
+ shouldBe("selection.focusOffset", "3");
+ }
+</script>
+<body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698