Skip to content

Commit 2f51314

Browse files
author
PR Batch Tester
committed
test(mobile): verify each shimmer step and clarify its pause
1 parent 067060f commit 2f51314

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎apps/mobile/src/features/threads/work-shimmer-steps.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ it("steps the sweep, stays quiet through the pause, and stops on cleanup", () =>
2020
const sweep = valuesDuring(SHIMMER_SWEEP_MS);
2121
expect(sweep).toHaveLength(SHIMMER_STEPS);
2222
expect(sweep.at(-1)).toBe(1);
23-
expect(sweep).toEqual([...sweep].sort((a, b) => a - b));
23+
expect(sweep).toEqual(Array.from({ length: SHIMMER_STEPS }, (_, i) => (i + 1) / SHIMMER_STEPS));
2424
expect(valuesDuring(SHIMMER_PAUSE_MS)).toEqual([]);
2525
expect(valuesDuring(SHIMMER_SWEEP_MS)).toEqual(sweep);
2626

‎apps/mobile/src/features/threads/work-shimmer-steps.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ export const SHIMMER_PAUSE_MS = 1_450;
33
export const SHIMMER_STEPS = 12;
44
const SHIMMER_STEP_MS = SHIMMER_SWEEP_MS / SHIMMER_STEPS;
55

6-
// Moves the sweep in discrete jumps, with no timer during the pause, so the
7-
// screen idles between steps instead of redrawing every frame. Progress 0 and 1
8-
// both sit off the content, so the cycle only needs steps 1 through SHIMMER_STEPS.
6+
// No progress updates run during the pause. Progress 0 and 1 both sit off the
7+
// content, so the cycle only needs steps 1 through SHIMMER_STEPS.
98
export function startShimmerSteps(progress: { setValue(value: number): void }): () => void {
109
let step = 0;
1110
let timer: ReturnType<typeof setTimeout>;

0 commit comments

Comments
 (0)