Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / move-by-line-004.html
blobb9ad7c15a20f3e374bfc71b75d0a7cec0f80f07a
1 <p>
2 Test that moving the caret with line granularity within the highest
3 editable root works across non-editable content.
4 </p>
5 <pre id="console"></pre>
6 <div contenteditable="true">
7 <div contenteditable="false">
8 <span id="pie" contenteditable="true">apple pie</span>
9 </div>
10 <div contenteditable="false">
11 pineapple
12 </div>
13 <div contenteditable="false">
14 <span id="juice" contenteditable="true">apple juice</span>
15 </div>
16 </div>
17 <script>
18 function log(message)
20 document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
23 if (window.testRunner)
24 testRunner.dumpAsText();
26 var fail = false;
27 var pie = document.getElementById("pie");
28 var juice = document.getElementById("juice");
30 var sel = getSelection();
31 sel.collapse(pie.firstChild, 3);
32 sel.modify("move", "forward", "line");
34 if (sel.anchorNode !== juice.firstChild || sel.anchorOffset != 3) {
35 log("FAIL: Did not move to the next line");
36 fail = true;
39 sel.collapse(juice.firstChild, 3);
40 sel.modify("move", "backward", "line");
42 if (sel.anchorNode !== pie.firstChild || sel.anchorOffset != 3) {
43 log("FAIL: Did not move to the previous line");
44 fail = true;
47 if (!fail)
48 log("PASS");
49 </script>