Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(Lightbox): the spring-zoom check catches a spring 5 % off (#10323)

Christopher Chedeaud853ba008a04
diff --git a/packages/core/src/Lightbox/LightboxFinePointer.a11y.browser.spec.ts b/packages/core/src/Lightbox/LightboxFinePointer.a11y.browser.spec.ts
index 96bc0545dd..a20f6b65c1 100644
--- a/packages/core/src/Lightbox/LightboxFinePointer.a11y.browser.spec.ts
+++ b/packages/core/src/Lightbox/LightboxFinePointer.a11y.browser.spec.ts
@@ -261,12 +261,13 @@ async function expectSpringZoom(
return ((await boxOf(img)).width - fitted.width) / (to - fitted.width);
};
// The spring's own course: about 0.36 at 100 ms, where a 200 ms ease-out
- // is past 0.6, and 0.72 at 200 ms.
+ // is past 0.6, and 0.72 at 200 ms. A spring 5 % slower or faster reads
+ // more than 0.02 off at 100 and 200 ms.
for (const ms of [100, 200, 300]) {
expect(
Math.abs((await progressAt(ms)) - settleProgress(ms)),
`${ms} ms`,
- ).toBeLessThan(0.08);
+ ).toBeLessThan(0.02);
}
// It comes within half a percent of the target near 0.59 s: not yet at
// 450 ms, and by 800 ms.