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> |