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> <!doctype html>
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. <script src="../../resources/ahem.js"></script>
</div> <script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="result" style="width: 200px;"> <script src="../assert_selection.js"></script>
<span>Hello,</span><span id="world">world!</span><br><span style="padding-left: 200px; padding-bottom: 200px; background-color: blue; height: 200px;"></span>
</div>
<script> <script>
if (window.testRunner) { // To test this manually, press mouse button below the 'F' and drag the mouse to
testRunner.dumpAsText(); // 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"); if (!window.internals)
var endX = world.offsetLeft; throw 'This test requires internals.';
var startX = endX + world.offsetWidth; internals.settings.setEditingBehavior(platform);
var endY = world.offsetTop;
var startY = endY + 50;
eventSender.mouseMoveTo(startX, startY); const target = selection.document.getElementById("target");
eventSender.mouseDown(); const endX = selection.computeLeft(target);
eventSender.mouseMoveTo(startX, startY); const startX = endX + target.offsetWidth;
eventSender.mouseMoveTo(endX, endY); const endY = selection.computeTop(target);
eventSender.mouseUp(); const startY = endY + 50;
var result = document.getElementById("result"); eventSender.leapForward(9999); // reset mouse button
if (window.getSelection() == "world!") { eventSender.mouseMoveTo(startX, startY);
result.style.backgroundColor = "green"; eventSender.mouseDown();
result.innerHTML = "PASS"; eventSender.mouseMoveTo(endX, endY);
} else eventSender.mouseUp();
result.innerHTML = "FAILED: the selection was " + window.getSelection(); },
[
'<div style="width: 200px;">',
'<b>ABC,</b><i id="target">|DEF^</i><br>',
`<b style="${kBlueBox}"></b>`,
'</div>',
], `${platform}`);
} }
</script> </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