From 817bcc3ba7b2aaad388bc5b2e5cda5ccf7b27766 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 9 Oct 2026 01:06:37 -0700 Subject: Restart wheel coast timing and respond immediately on reversal --- tools/feed-momentum-test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tools/feed-momentum-test.js') diff --git a/tools/feed-momentum-test.js b/tools/feed-momentum-test.js index 9f61667..29e4934 100644 --- a/tools/feed-momentum-test.js +++ b/tools/feed-momentum-test.js @@ -57,6 +57,20 @@ try { await sleep(60); await notch(-1); const brake = await settle(); check('a reverse turn brakes the coast', brake < 3 * one, brake + 'px'); + for (const dir of [1, -1]) { + await page.evaluate(() => window.scrollTo(0, 2000)); + await notch(dir); await sleep(60); + const first = await page.evaluate((dir) => { + const ev = new WheelEvent('wheel', { deltaY: -dir * 100, deltaMode: 0, bubbles: true, cancelable: true }); + Object.defineProperty(ev, 'wheelDeltaY', { value: dir * 120 }); + const before = scrollY; + document.querySelector('#stand-in p').dispatchEvent(ev); + return scrollY - before; + }, dir); + check('reversal responds immediately with a small step (' + dir + ')', first * dir < 0 && Math.abs(first) <= 16, first + 'px'); + await settle(); + } + await top(); check('a trackpad\'s smooth deltas are the browser\'s', !(await notch(1, true))); check('...and a notch right after them too (still a trackpad)', !(await notch(1))); -- cgit v1.2.3