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

Unified Diff: LayoutTests/editing/input/ctrl-up-down.html

Issue 17828002: Add Ctrl+(+Shift)+Up/Down key bindings for Windows (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-06-27T14:50:09 Created 7 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/input/ctrl-up-down.html
diff --git a/LayoutTests/editing/input/ctrl-up-down.html b/LayoutTests/editing/input/ctrl-up-down.html
new file mode 100644
index 0000000000000000000000000000000000000000..4b3d20fb32e5252ac9cec059d8632e1145f9c84f
--- /dev/null
+++ b/LayoutTests/editing/input/ctrl-up-down.html
@@ -0,0 +1,52 @@
+<div id="container">
+<p id="description"></p>
+Manual steps:
+<ol>
+<li>Move middle of the first paragraph</li>
+<li>Type Ctrl+Up</li>
+<li>Caret should be start of paragrah</li>
+<li>Type Ctrl+Down</li>
+<li>Caret should be next paragrah</li>
+<li>Do above step with Ctrl+Shift key to extend selection</li>
+</ol>
+Sample editable:
+<div id="sample" contenteditable="true"><p>This is the first paragraph. Key binding of Ctrl+Up/Down are available only Windows.</p><p>This is second paragraph. Do you want to have these key bindings on other platforms?</p>
+</div>
+</div>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script>
+description('Test Ctrl+Up/Down motion');
+function $(id) { return document.getElementById(id); }
+var sample = $('sample');
+var selection = window.getSelection();
+var range = document.createRange();
+range.setStart(sample.firstChild.firstChild, 3);
+selection.addRange(range);
+sample.focus();
+var paragraph1 = sample.firstChild.firstChild;
+var paragraph2 = sample.childNodes[1].firstChild;
+if (window.eventSender) {
+ eventSender.keyDown('upArrow', ['ctrlKey']);
+ shouldBeEqualToString('selection.type', 'Caret');
+ shouldBe('selection.focusNode', 'paragraph1');
+ shouldBe('selection.focusOffset', '0');
+
+ eventSender.keyDown('downArrow', ['ctrlKey']);
+ shouldBeEqualToString('selection.type', 'Caret');
+ shouldBe('selection.focusNode', 'paragraph2');
+ shouldBe('selection.focusOffset', '3');
+
+ eventSender.keyDown('downArrow', ['ctrlKey', 'shiftKey']);
+ shouldBeEqualToString('selection.type', 'Range');
+ shouldBe('selection.focusNode', 'paragraph2');
+ shouldBe('selection.focusOffset', '84');
+
+ eventSender.keyDown('upArrow', ['ctrlKey', 'shiftKey']);
+ shouldBeEqualToString('selection.type', 'Range');
+ shouldBe('selection.focusNode', 'paragraph1');
+ shouldBe('selection.focusOffset', '3');
+}
+if (window.testRunner)
+ $('container').outerHTML = '';
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>

Powered by Google App Engine
This is Rietveld 408576698