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 2169073083dc3ef5e581098e64b924d524f26562..38deeaba172add362c249835f2f142d7e03fab75 100644 |
--- a/LayoutTests/editing/selection/move-by-line-004.html |
+++ b/LayoutTests/editing/selection/move-by-line-004.html |
@@ -1,7 +1,9 @@ |
-<script src="../../fast/js/resources/js-test-pre.js"></script> |
-<script src="./resources/js-test-selection-shared.js"></script> |
- |
-<div id="test" contenteditable="true"> |
+<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"> |
<div contenteditable="false"> |
<span id="pie" contenteditable="true">apple pie</span> |
</div> |
@@ -12,29 +14,36 @@ |
<span id="juice" contenteditable="true">apple juice</span> |
</div> |
</div> |
- |
<script> |
-description('Test that moving the caret with line granularity within the highest editable root doesn\'t work across non-editable content.'); |
+ 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; |
+ } |
-testCaretMotion({ |
- 'direction': 'forward', |
- 'granularity': 'line', |
- 'origin': 'pie', |
- 'originOffset': 3, |
- 'target': 'pie', |
- 'targetOffset': -1, |
-}); |
+ sel.setPosition(juice.firstChild, 3); |
+ sel.modify("move", "backward", "line"); |
-testCaretMotion({ |
- 'direction': 'backward', |
- 'granularity': 'line', |
- 'origin': 'juice', |
- 'originOffset': 3, |
- 'target': 'juice', |
- 'targetOffset': 0, |
-}); |
+ if (sel.anchorNode !== pie.firstChild || sel.anchorOffset != 3) { |
+ log("FAIL: Did not move to the previous line"); |
+ fail = true; |
+ } |
-if (window.testRunner) |
- $('test').outerHTML = ''; |
+ if (!fail) |
+ log("PASS"); |
</script> |
-<script src="../../fast/js/resources/js-test-post.js"></script> |