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

Unified Diff: LayoutTests/editing/selection/move-by-line-004.html

Issue 14794012: Make contenteditable="false" element as atomic node for selection motion (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-05-27T14:00 Created 7 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
Index: LayoutTests/editing/selection/move-by-line-004.html
diff --git a/LayoutTests/editing/selection/move-by-line-004.html b/LayoutTests/editing/selection/move-by-line-004.html
index 38deeaba172add362c249835f2f142d7e03fab75..2169073083dc3ef5e581098e64b924d524f26562 100644
--- a/LayoutTests/editing/selection/move-by-line-004.html
+++ b/LayoutTests/editing/selection/move-by-line-004.html
@@ -1,9 +1,7 @@
-<p>
- Test that moving the caret with line granularity within the highest
- editable root works across non-editable content.
-</p>
-<pre id="console"></pre>
-<div contenteditable="true">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="./resources/js-test-selection-shared.js"></script>
+
+<div id="test" contenteditable="true">
<div contenteditable="false">
<span id="pie" contenteditable="true">apple pie</span>
</div>
@@ -14,36 +12,29 @@
<span id="juice" contenteditable="true">apple juice</span>
</div>
</div>
-<script>
- function log(message)
- {
- document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
- }
-
- if (window.testRunner)
- testRunner.dumpAsText();
- var fail = false;
- var pie = document.getElementById("pie");
- var juice = document.getElementById("juice");
-
- var sel = getSelection();
- sel.setPosition(pie.firstChild, 3);
- sel.modify("move", "forward", "line");
-
- if (sel.anchorNode !== juice.firstChild || sel.anchorOffset != 3) {
- log("FAIL: Did not move to the next line");
- fail = true;
- }
+<script>
+description('Test that moving the caret with line granularity within the highest editable root doesn\'t work across non-editable content.');
- sel.setPosition(juice.firstChild, 3);
- sel.modify("move", "backward", "line");
+testCaretMotion({
+ 'direction': 'forward',
+ 'granularity': 'line',
+ 'origin': 'pie',
+ 'originOffset': 3,
+ 'target': 'pie',
+ 'targetOffset': -1,
+});
- if (sel.anchorNode !== pie.firstChild || sel.anchorOffset != 3) {
- log("FAIL: Did not move to the previous line");
- fail = true;
- }
+testCaretMotion({
+ 'direction': 'backward',
+ 'granularity': 'line',
+ 'origin': 'juice',
+ 'originOffset': 3,
+ 'target': 'juice',
+ 'targetOffset': 0,
+});
- if (!fail)
- log("PASS");
+if (window.testRunner)
+ $('test').outerHTML = '';
</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>

Powered by Google App Engine
This is Rietveld 408576698