Missing cursor/caret showing in search field on google.com
[WebKit-https.git] / LayoutTests / editing / selection / skip-non-editable-2.html
1 <head>
2 <script>
3 if (window.testRunner)
4      testRunner.dumpEditingCallbacks();
5 </script>
6
7 <script>
8 function log(str) {
9     var li = document.createElement("li");
10     li.appendChild(document.createTextNode(str));
11     var console = document.getElementById("console");
12     console.appendChild(li);
13 }
14
15 function assert(bool) {
16     if (!bool)
17         log("Failure");
18     else
19         log("Success");
20 }
21 </script>
22 </head>
23
24 <body contentEditable="true">
25 <p>This tests moving the caret in content of mixed editability.  The caret should jump to the next editable region that shares a common editable ancestor when it reaches non-editable content.</p>
26 <span id="e1">editable</span><span id="e2" contentEditable="false" style="font-weight:bold">noneditable</span><span id="e3">editable</span>
27
28
29 <ul id="console"></ul>
30 </body>
31
32 <script>
33 if (window.testRunner)
34     window.testRunner.dumpAsText();
35     
36 var s = window.getSelection();
37 var e1 = document.getElementById("e1");
38 var e2 = document.getElementById("e2");
39 var e3 = document.getElementById("e3");
40
41 s.setPosition(e1.firstChild, e1.firstChild.length);
42 s.modify("move", "forward", "character");
43 assert(s.anchorNode == e3.firstChild && s.anchorOffset == 0);
44
45 s.modify("move", "backward", "character");
46 assert(s.anchorNode == e1.firstChild && s.anchorOffset == e1.firstChild.length);
47 </script>