fix: close phase 2 journey blockers
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user