Files
ladybird/Tests/LibWeb/Text/input/iframe-click-after-parent-scroll.html
Tim Ledbetter 5b98e94625 Tests: Fix race condition in iframe-click-after-parent-scroll test
Previously, the iframe's load event could fire during HTML parsing,
before the test had started running. We now create the iframe in JS and
append it to the document so that callbacks are executed in the correct
order.
2026-03-10 11:40:02 +01:00

34 lines
902 B
HTML

<!DOCTYPE html>
<style>
body { margin: 0; height: 2000px; }
iframe {
position: absolute;
top: 100px;
left: 50px;
width: 200px;
height: 200px;
border: none;
}
</style>
<script src="include.js"></script>
<script>
asyncTest((done) => {
window.reportClick = function(x, y) {
println(`click at (${x}, ${y})`);
done();
};
const iframe = document.createElement("iframe");
iframe.onload = () => {
window.scrollTo(0, 50);
internals.click(60, 60);
};
iframe.srcdoc = `
<!DOCTYPE html>
<style>body { margin: 0; }</style>
<div style='width: 100px; height: 100px'
onclick='parent.reportClick(event.clientX, event.clientY)'></div>
`;
document.body.appendChild(iframe);
});
</script>