Missing cursor/caret showing in search field on google.com
[WebKit-https.git] / LayoutTests / editing / selection / click-on-head-margin.html
1 <!DOCTYPE html>
2 <html>
3 <head contenteditable style="display: block; white-space: nowrap; margin:100px; border: solid 1px black;"></head>
4 <body>
5 <div id="firstLine">Click on the right of this line outside the black box.</div>
6 <span id="longLine">The caret should be placed on the right of the first line, NOT on the right of this line.<span></span></span>
7 <pre><script>
8
9 var head = document.getElementsByTagName('head')[0];
10 var longLine = document.getElementById('longLine');
11 var firstLine = document.getElementById('firstLine');
12
13 // Work-around HTML5 parser.
14 head.appendChild(firstLine);
15 head.appendChild(longLine);
16
17 while (longLine.offsetWidth < head.offsetWidth + 200)
18     longLine.lastChild.textContent += ' some text';
19
20 if (window.testRunner) {
21     testRunner.dumpAsText();
22
23     eventSender.mouseMoveTo(firstLine.offsetLeft + head.offsetWidth + 10,
24         100 + firstLine.offsetHeight / 2);
25     eventSender.mouseDown();
26     eventSender.mouseUp();
27
28     if (!getSelection().isCollapsed)
29         document.writeln('FAIL - selection was not collapsed');
30     else if (getSelection().baseNode != firstLine.firstChild)
31         document.writeln('FAIL - caret was not in the first line');
32     else if (getSelection().baseOffset != firstLine.textContent.length)
33         document.writeln('FAIL - caret was not on the right edge');
34     else
35         document.writeln('PASS');
36
37     longLine.lastChild.style.display = 'none';
38 }
39
40 </script></pre>
41 </body>
42 </html>