mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
Instead of defining somewhat high level mouse actions, allow granular control of mouse clicks and mouse down/up/move events. We will want to simulate things like holding down a mouse button after double clicking and then dragging the mouse to another position in the future, and this enables that.
38 lines
1002 B
HTML
38 lines
1002 B
HTML
<!DOCTYPE html>
|
|
<iframe id="iframe"></iframe>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
const runTest = () => {
|
|
return new Promise(resolve => {
|
|
let iframe = document.getElementById("iframe");
|
|
|
|
iframe.onload = () => {
|
|
internals.mouseMove(20, 40);
|
|
internals.mouseDown(20, 40);
|
|
internals.mouseMove(60, 40);
|
|
|
|
iframe.onload = () => {
|
|
setTimeout(() => {
|
|
internals.mouseMove(20, 40);
|
|
resolve();
|
|
});
|
|
};
|
|
|
|
iframe.src = "data:text/html,<p contenteditable>Text 2</p>";
|
|
};
|
|
|
|
iframe.src = "data:text/html,<p contenteditable>Text 1</p>";
|
|
});
|
|
};
|
|
|
|
asyncTest(async done => {
|
|
for (let i = 0; i < 10; ++i) {
|
|
await runTest();
|
|
internals.gc();
|
|
}
|
|
|
|
println("PASS (didn't crash)");
|
|
done();
|
|
});
|
|
</script>
|