Tests: Wait for iframe scroll range before wheel

Let the iframe render before setting it to its bottom scroll boundary.
Otherwise the scrollTop assignment can clamp against stale geometry on
slow CI runs, leaving the iframe able to consume the wheel event instead
of falling back to the parent viewport.
This commit is contained in:
Andreas Kling 2026-05-22 15:01:30 +02:00 committed by Andreas Kling
parent ae299920f2
commit ad9c8df75a

View file

@ -22,6 +22,7 @@
promiseTest(async () => {
const iframe = document.createElement("iframe");
iframe.id = "iframe";
const iframeLoaded = new Promise(resolve => iframe.addEventListener("load", resolve, { once: true }));
iframe.srcdoc = `
<!DOCTYPE html>
<style>
@ -34,7 +35,10 @@
`;
document.body.prepend(iframe);
await new Promise(resolve => iframe.addEventListener("load", resolve, { once: true }));
await iframeLoaded;
// Let the iframe compute its scroll range before clamping scrollTop to its bottom edge.
await animationFrame();
await animationFrame();
const scrollingElement = iframe.contentDocument.scrollingElement;
scrollingElement.scrollTop = 10000;