fix: close phase 2 journey blockers

This commit is contained in:
2026-09-02 06:04:20 +03:00
parent a86767cdc6
commit 77895c01ff
19 changed files with 378 additions and 26 deletions

View File

@@ -247,6 +247,33 @@ describe('useScrollDrive', () => {
acceleration: expect.closeTo(0.6708070121920944, 14),
driveSpeed: expect.closeTo(0.7300617499975173, 14),
});
expect(callbacks).toHaveLength(1);
const decayingAccelerations: number[] = [];
let frameNow = 216;
while (callbacks.size > 0 && frameNow < 10_000) {
expect(callbacks).toHaveLength(1);
const decayFrame = [...callbacks.entries()][0]!;
callbacks.delete(decayFrame[0]);
decayFrame[1](frameNow);
await nextTick();
decayingAccelerations.push(drive().acceleration);
frameNow += 16;
}
expect(decayingAccelerations.length).toBeGreaterThan(1);
expect(decayingAccelerations.every((value, index) => (
index === 0 || value <= decayingAccelerations[index - 1]!
))).toBe(true);
expect(decayingAccelerations.at(-1)).toBe(0);
expect(drive()).toMatchObject({
scrollY: 750,
routeProgress: 0.75,
direction: 0,
acceleration: 0,
driveSpeed: 0.18,
});
expect(callbacks).toHaveLength(0);
window.dispatchEvent(new Event('scroll'));
expect(callbacks).toHaveLength(1);