Commit ba743575 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize selection_test() in editing/selection/last-empty-inline.html

This patch changes "last-empty-inline.html" to utilize |selection_test()| for
ease of maintenance and help to implementing EditingNG.

Bug: 707656, 679977
Change-Id: I273a2978f313c93aef033bc72725759d86e551c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2224593
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@{#773994}
parent a9d20f06
To test this manually, press mouse button below the '!' and drag the mouse to the comma between "Hello" and "world!". It's OK if "world!" is selected.
PASS
<div>
To test this manually, press mouse button below the '!' and drag the mouse to the comma between "Hello" and "world!". It's OK if "world!" is selected.
</div>
<div id="result" style="width: 200px;">
<span>Hello,</span><span id="world">world!</span><br><span style="padding-left: 200px; padding-bottom: 200px; background-color: blue; height: 200px;"></span>
</div>
<!doctype html>
<script src="../../resources/ahem.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
// To test this manually, press mouse button below the 'F' and drag the mouse to
// the comma between "ABC" and "DEF".
const kBlueBox = [
'padding-left: 200px;',
'padding-bottom: 200px;',
'background-color: blue;',
'height: 200px;',
].join(' ');
for (const platform of ['android', 'mac', 'unix', 'win']) {
selection_test(
[
'<div style="width: 200px;">',
'<b>ABC,</b><i id="target">DEF</i><br>',
`<b style="${kBlueBox}"></b>`,
'</div>',
],
selection => {
if (!window.eventSender)
throw 'This test requires eventSender.';
var world = document.getElementById("world");
var endX = world.offsetLeft;
var startX = endX + world.offsetWidth;
var endY = world.offsetTop;
var startY = endY + 50;
if (!window.internals)
throw 'This test requires internals.';
internals.settings.setEditingBehavior(platform);
eventSender.mouseMoveTo(startX, startY);
eventSender.mouseDown();
eventSender.mouseMoveTo(startX, startY);
eventSender.mouseMoveTo(endX, endY);
eventSender.mouseUp();
const target = selection.document.getElementById("target");
const endX = selection.computeLeft(target);
const startX = endX + target.offsetWidth;
const endY = selection.computeTop(target);
const startY = endY + 50;
var result = document.getElementById("result");
if (window.getSelection() == "world!") {
result.style.backgroundColor = "green";
result.innerHTML = "PASS";
} else
result.innerHTML = "FAILED: the selection was " + window.getSelection();
eventSender.leapForward(9999); // reset mouse button
eventSender.mouseMoveTo(startX, startY);
eventSender.mouseDown();
eventSender.mouseMoveTo(endX, endY);
eventSender.mouseUp();
},
[
'<div style="width: 200px;">',
'<b>ABC,</b><i id="target">|DEF^</i><br>',
`<b style="${kBlueBox}"></b>`,
'</div>',
], `${platform}`);
}
</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