diff options
| author | Adam Soltys <[email protected]> | 2026-11-17 17:08:55 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-11-17 17:08:55 -0700 |
| commit | 262c2e36096ae0a2c66a620d01ee9132de746670 (patch) | |
| tree | 67e1e542088968d0bc839869a6cdee7ed005c0fd /tools/feed-when-test.js | |
| parent | 8d2f2c72a7bb7087879e110f8575bcef00bbc2c0 (diff) | |
| download | coinosv3-262c2e36096ae0a2c66a620d01ee9132de746670.tar.gz coinosv3-262c2e36096ae0a2c66a620d01ee9132de746670.zip | |
The scroll date chip blends between posts and goes the moment you stop. "I'm good with blending. Can you make the chip appear and disappear faster? I want it gone as soon as I'm stopped to look at something" (Adam, 2026-11-17). The time now moves between the post at the top of the screen and the next one, in step with how far through that post you've scrolled. The clock rolls with the scroll instead of jumping from post to post, and runs quickly through a gap between posts. The chip leaves 250 ms after the last scroll event (was 1.2 s); a coast keeps sending events, so it stays while the page is still moving. It fades in over 80 ms and out over 120 ms. feed-when-test (blended time between the two posts, rolls with a few px of scroll, gone half a second after stopping) and feed-new-posts pass.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6SwkivduFDDkMmnXjZ
Diffstat (limited to 'tools/feed-when-test.js')
| -rw-r--r-- | tools/feed-when-test.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/feed-when-test.js b/tools/feed-when-test.js index d9baa50..38be4ef 100644 --- a/tools/feed-when-test.js +++ b/tools/feed-when-test.js @@ -119,11 +119,16 @@ try { }); const ev = shown && seeded.find((e) => e.id === shown.key); check('the chip shows while scrolling, under the top bar', !!shown && shown.y >= shown.head, JSON.stringify(shown)); - const want = ev && await page.evaluate((s) => new Date(s * 1000).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' }), ev.created_at); - check('...with the time of the post at the top of the screen', !!want && shown.text.includes(want), shown?.text + ' / ' + want); + // seeded posts are two hours apart: the chip's minute is one of those between this post and the next + const between = ev && await page.evaluate((s) => Array.from({ length: 121 }, (_, m) => new Date((s - m * 60) * 1000).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' })), ev.created_at); + check('...with a time between the top post and the next', !!between && between.some((x) => shown.text.includes(x)), shown?.text); check('...and how long ago', /ago|yesterday/i.test(shown?.text || ''), shown?.text); if (process.env.SHOT) await page.screenshot({ path: process.env.SHOT }); - await sleep(1700); + // the clock rolls between posts: a few px down the same post moves it on + const at = (y) => page.evaluate(async (y) => { scrollBy(0, y); await new Promise((r) => setTimeout(r, 60)); return document.querySelector('.feed-when')?.textContent; }, y); + const a = await at(1), b = await at(60); + check('the time blends between posts as you scroll', !!a && !!b && a !== b, a + ' → ' + b); + await sleep(450); check('it fades once the scrolling stops', !(await page.$('.feed-when.on'))); check('no page errors', !errors.length, errors.join('; ')); } finally { |
