From 9e92d9268469788ef9c066f56d6115462d044eeb Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 7 Feb 2023 15:56:43 -0500 Subject: [PATCH] whitespace --- src/internal/test/wait-for-scrolling.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/internal/test/wait-for-scrolling.ts b/src/internal/test/wait-for-scrolling.ts index ea49bd06f..cb835a12e 100644 --- a/src/internal/test/wait-for-scrolling.ts +++ b/src/internal/test/wait-for-scrolling.ts @@ -10,10 +10,12 @@ export const waitForScrollingToEnd = (element: Element, timeoutInMs = 500): Prom let lastLeft = element.scrollLeft; let lastTop = element.scrollTop; let framesWithoutChange = 0; + return new Promise((resolve, reject) => { const timeout = window.setTimeout(() => { reject(new Error('Waiting for scroll end timed out')); }, timeoutInMs); + function checkScrollingChanged() { if (element.scrollLeft !== lastLeft || element.scrollTop !== lastTop) { framesWithoutChange = 0; @@ -28,6 +30,7 @@ export const waitForScrollingToEnd = (element: Element, timeoutInMs = 500): Prom } window.requestAnimationFrame(checkScrollingChanged); } + checkScrollingChanged(); }); };