mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-03 22:59:13 +00:00
We are often trying to click the image before it has finished loading. This results in us trying to click a 0x0 rect. Instead, wait until the image load event. This fixes a flake with form-image-submission.html often seen on CI.
36 lines
1,014 B
HTML
36 lines
1,014 B
HTML
<head>
|
|
<!--
|
|
These style rules ensure the (x,y) coordinates clicked below are the same as the resulting
|
|
coordinates in the form submission event.
|
|
-->
|
|
<style type="text/css">
|
|
dialog {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<dialog id="dialog" open>
|
|
<form id="form" method="dialog">
|
|
<input value="well hello friends!" />
|
|
<input id="image" type="image" src="../../../Layout/input/120.png" />
|
|
</form>
|
|
</dialog>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest(done => {
|
|
let dialog = document.getElementById("dialog");
|
|
let image = document.getElementById("image");
|
|
|
|
dialog.addEventListener("close", e => {
|
|
println(dialog.returnValue);
|
|
done();
|
|
});
|
|
|
|
image.addEventListener("load", () => {
|
|
const imageRect = image.getBoundingClientRect();
|
|
internals.click(imageRect.x + 10, imageRect.y + 20);
|
|
});
|
|
});
|
|
</script>
|