Commit 239ec88c authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in editing/selection/block-with-positioned-lastchild.html

This patch changes "block-with-positioned-lastchild.html" to utilize
|selection_test()| for ease of maintenance and help to implementing EditingNG.

Bug: 707656, 679977
Change-Id: Ibf7e74bae974f3e0ed77ae7905e19b0510d77e18
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2208317
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#770019}
parent 87ed476f
Click on the left of this line.
Caret should NOT be placed in this line,
PASS
<!DOCTYPE html>
<html>
<body>
<div style="padding: 20px;" contenteditable>Click on the left of this line.
<div>Caret should NOT be placed in this line,</div>
<div style="position:absolute; top:0px; right:0px;"></div>
</div>
<pre><script>
if (window.testRunner) {
testRunner.dumpAsText();
var container = document.body.children[0];
eventSender.mouseMoveTo(container.offsetLeft + 5, container.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseUp();
if (!getSelection().isCollapsed)
document.writeln('FAIL - selection was not collapsed');
else if (getSelection().baseNode != container.firstChild)
document.writeln('FAIL - caret was not in the first line');
else if (getSelection().baseOffset)
document.writeln('FAIL - caret was not on the left edge');
else
document.writeln('PASS');
}
</script></pre>
</body>
</html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
[
'<div contenteditable id="target" style="padding: 20px;">',
'abc',
'<div>def</div>',
'<div style="position:absolute; top:0px; right:0px;"></div>',
'</div>',
],
selection => {
if (!window.eventSender)
throw 'This test requires eventSender.';
const target = selection.document.getElementById('target');
eventSender.mouseMoveTo(selection.computeLeft(target) + 5,
selection.computeTop(target) + 5);
eventSender.mouseDown();
eventSender.mouseUp();
},
[
'<div contenteditable id="target" style="padding: 20px;">',
'|abc',
'<div>def</div>',
'<div style="position:absolute; top:0px; right:0px;"></div>',
'</div>',
]);
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment