Skip to content

Commit d67bde9

Browse files
committed
improve comments
1 parent 8b5e64e commit d67bde9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/__tests__/useOnInView.test.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -455,12 +455,12 @@ test("should track thresholds when crossing multiple in a single update", () =>
455455
mockAllIsIntersecting(0);
456456
expect(element.getAttribute("data-cleanup-count")).toBe("1");
457457

458-
// Jump to full visibility
458+
// Change to 0.5 (crosses 0.2, 0.4 thresholds)
459459
mockAllIsIntersecting(0.5);
460460
expect(element.getAttribute("data-trigger-count")).toBe("2");
461461
expect(element.getAttribute("data-last-ratio")).toBe("0.40");
462462

463-
// Jump to full visibility
463+
// Jump to full visibility - should cleanup the 0.5 callback
464464
mockAllIsIntersecting(1.0);
465465
expect(element.getAttribute("data-trigger-count")).toBe("3");
466466
expect(element.getAttribute("data-cleanup-count")).toBe("2");

0 commit comments

Comments
 (0)