Skip to content

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

TypeScript

test(core): the inline-end edge reveal's reversal proof reads both sides on the animation's own clock (#9298)

Christopher Chedeau8b78da84a537
diff --git a/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts b/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts
index 9544b24618..9802791837 100644
--- a/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts
+++ b/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts
@@ -1990,25 +1990,27 @@ test.describe('spec:AST-105 FR9 (the edge reveal)', () => {
await frame();
read('opening');
}
+ // Closed again 120 ms into the reveal, as the page shows it then:
+ // held, so the module's reading of the item after it and this
+ // test's read the same time (a running transform is evaluated at a
+ // time of its own in WebKit).
+ window.holdAt(120);
+ read('reversed');
+ const closing = window.AnimatedLayout.reportLayoutChange(
+ layout,
+ () => content,
+ );
+ closing.measureBefore();
+ closing.animate();
+ window.AnimatedLayout.holdLayoutExit(layout, content, () => {}, {
+ edge: 'inline-end',
+ });
await new Promise<void>(resolve => {
- requestAnimationFrame(() => {
- read('reversed');
- const closing = window.AnimatedLayout.reportLayoutChange(
- layout,
- () => content,
- );
- closing.measureBefore();
- closing.animate();
- window.AnimatedLayout.holdLayoutExit(layout, content, () => {}, {
- edge: 'inline-end',
- });
- // Where the conceal starts, on its own clock, once it rides.
- queueMicrotask(() => {
- read('restart');
- resolve();
- });
- });
+ queueMicrotask(resolve);
});
+ // Where the conceal starts, on its own clock, once it rides.
+ read('restart');
+ window.resumeAll();
for (let i = 0; i < 60; i++) {
await frame();
read('closing');
@@ -2025,6 +2027,8 @@ test.describe('spec:AST-105 FR9 (the edge reveal)', () => {
reportSkew(shown, browserName);
const reversed = frames.find(f => f.phase === 'reversed') as EdgeFrame;
const restart = frames.find(f => f.phase === 'restart') as EdgeFrame;
+ expect(reversed.shown).toBeGreaterThan(5);
+ expect(reversed.shown).toBeLessThan(115);
expect(Math.abs(restart.shown - reversed.shown)).toBeLessThan(1.5);
});
}