Commit 55f186ee authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in editing/selection/caret-ltr.html

This patch changes "caret-ltr.html" to utilize |selection_test()| for ease of
maintenance and enabling EditingNG.

Bug: 679977, 707656
Change-Id: I7824072725bd418bed800b0a114bcd1b74fafa62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2262399
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#781761}
parent f53eb62d
<!DOCTYPE html> <!DOCTYPE html>
<html> <script src="../../resources/testharness.js"></script>
<body> <script src="../../resources/testharnessreport.js"></script>
<p> <script src="../assert_selection.js"></script>
This tests that clicking in a contenteditable div will set the caret in the right position for LTR text in a LTR block.
To test manually, click the left of the text. The caret should be on the left edge.
</p>
<div style="font-size: 20px; width: 20ex; border: solid thin black; padding: 10px;" contenteditable>WebKit2</div>
<script src="resources/caret-edge-shared.js"></script>
<script> <script>
// This tests that clicking in a contenteditable div will set the caret in the
// right position for LTR text in a LTR block.
// To test manually, click the left of the text. The caret should be on the left
// edge.
const kStyle = [
'border: solid thin black;',
'font-size: 20px;',
'padding: 10px;',
'width: 20ex;',
].join('');
var clickOn = 'left'; selection_test(
var expectedOffset = 0; `<div contenteditable id="target" style="${kStyle}">XYZ</div>`,
selection => {
runTest(); const target = selection.document.getElementById('target');
if (!window.eventSender)
throw 'This test requires eventSender.';
eventSender.leapForward(9999); // reset mouse click state
eventSender.mouseMoveTo(
selection.computeLeft(target) + 5,
selection.computeTop(target) + 5);
eventSender.mouseDown();
eventSender.mouseUp();
},
`<div contenteditable id="target" style="${kStyle}">|XYZ</div>`,
'Click the left of text.');
</script> </script>
</body>
</html>
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