Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / click-after-nested-block.html
blob34a46d3bdccad842c40375124639b8c3eed9df26
1 <html>
2 <head>
3 <script>
5 function runTest()
7 if (!window.testRunner)
8 return;
10 testRunner.dumpAsText();
12 var target = document.getElementById("test");
14 x = target.offsetLeft + target.offsetWidth - 10;
15 y = target.offsetTop + target.offsetHeight - 10;
17 eventSender.mouseMoveTo(x, y);
18 eventSender.mouseDown();
19 eventSender.mouseUp();
22 function setTestResultMessage()
24 var line2Text = document.getElementById("line2").firstChild;
26 var result = "FAILED";
27 if (getSelection().rangeCount !== 1)
28 result = "FAILED: Selection had range count of " + getSelection().rangeCount;
29 else if (getSelection().getRangeAt(0).startContainer !== line2Text)
30 result = "FAILED: Selection was not within second line of text.";
31 else if (getSelection().getRangeAt(0).endContainer !== line2Text)
32 result = "FAILED: Selection end was not within second line of text.";
33 else if (getSelection().getRangeAt(0).startOffset !== getSelection().getRangeAt(0).endOffset)
34 result = "FAILED: Selection was not a caret.";
35 else if (getSelection().getRangeAt(0).startOffset !== 6)
36 result = "FAILED: Selection was not at the end of the line.";
37 else
38 result = "SUCCESS";
40 document.getElementById("message").firstChild.data = result;
43 </script>
44 </head>
45 <body onload="runTest()" onclick="setTestResultMessage()">
46 <p>
47 This is a test for a bug where clicking below a block didn't work right if
48 the block was nested inside an inline.
49 </p>
50 <p>
51 To test interactively, click below and to the right of the 2 in line 2.
52 The caret should appear after the 2.
53 </p>
54 <p id="message">TEST HAS NOT RUN YET</p>
55 <hr>
56 <div contenteditable id="test" style="font-size: 48px; width: 250px; height: 250px"><div>line 1</div><div><span><div id="line2">line 2</div></span></div></div>
57 </body>