aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/pager-tap-slop-test.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/pager-tap-slop-test.js b/tools/pager-tap-slop-test.js
index c8d3609..b0bd339 100644
--- a/tools/pager-tap-slop-test.js
+++ b/tools/pager-tap-slop-test.js
@@ -123,6 +123,16 @@ try {
await drag(195, 500, 0, -80, 2);
s = await st();
check('a quick 80px flick up: the next post', s.on === was, JSON.stringify(s));
+
+ console.log('\n[snappy: let go, and it lands at once]');
+ await drag(195, 500, 0, 300, 8);
+ await page.touchscreen.touchStart(195, 650);
+ for (let i = 1; i <= 8; i++) { await page.touchscreen.touchMove(195, 650 - 40 * i); await sleep(16); }
+ // from the finger lifting to the next slide resting square on the screen
+ await page.evaluate(() => { window.__landed = new Promise((res) => { const t0 = performance.now(); const look = () => { const s = [...document.querySelectorAll('.mp-slide')].find((x) => { const r = x.getBoundingClientRect(); return Math.abs(r.top) < 1 && Math.abs(r.left) < 1; }); if (s && !s.getAttribute('data-k').endsWith('/tall.webm')) res(Math.round(performance.now() - t0)); else if (performance.now() - t0 > 2000) res(-1); else requestAnimationFrame(look); }; requestAnimationFrame(look); }); });
+ await page.touchscreen.touchEnd();
+ const ms = await page.evaluate(() => window.__landed);
+ check('a swipe lands on the next post within 300ms', ms > 0 && ms <= 300, ms + 'ms');
check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | '));
} finally { await browser.close(); server.stop(true); }
console.log(ok ? '\nāœ… a little movement is still a tap' : '\nāŒ failed');