Skip to content

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

TypeScript

test(core): the edge rides count each phase on its own reads (#10578)

Christopher Chedeau9e86adb575a9
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 db6403e081..00e29cd472 100644
--- a/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts
+++ b/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts
@@ -2751,13 +2751,18 @@ test.describe('spec:AST-105 FR9 (the edge reveal)', () => {
expect(Math.abs(bottom - result.openBottom)).toBeLessThan(1);
}
reportSkew(shown, browserName);
- // The held reads judge the curves. These prove the page drew both.
+ // The held reads judge the curves. These prove the page drew both. Each
+ // phase is judged on its own reads, so a gap in the other phase cannot
+ // name it starved.
for (const phase of ['opening', 'closing']) {
- requireFrames(result.frames, {
- min: 5,
- during: `the ${phase === 'opening' ? 'reveal' : 'conceal'} plays`,
- where: f => f.phase === phase && f.shown > 0.5,
- });
+ requireFrames(
+ result.frames.filter(f => f.phase.startsWith(phase)),
+ {
+ min: 5,
+ during: `the ${phase === 'opening' ? 'reveal' : 'conceal'} plays`,
+ where: f => f.phase === phase && f.shown > 0.5,
+ },
+ );
}
});
diff --git a/packages/core/src/motion/__tests__/animatedLayoutAdopters.interaction.browser.spec.ts b/packages/core/src/motion/__tests__/animatedLayoutAdopters.interaction.browser.spec.ts
index 76b9edf5a2..ac6848f705 100644
--- a/packages/core/src/motion/__tests__/animatedLayoutAdopters.interaction.browser.spec.ts
+++ b/packages/core/src/motion/__tests__/animatedLayoutAdopters.interaction.browser.spec.ts
@@ -394,20 +394,27 @@ function expectEdgeRide(result: EdgeRide): void {
expect(f.gap, detail).toBeGreaterThan(result.restGap - result.beyond - 1.5);
}
// The held reads judge the curves. These prove the page drew the motion.
- // Its two drawn reveal frames come while the reveal still rides, so the
- // reversal still finds it.
- requireFrames(result.frames, {
- min: 2,
- during: 'the reveal plays',
- where: f => f.phase === 'opening',
- });
+ // Each phase is judged on its own reads, so a gap in the other phase cannot
+ // name it starved. Its two drawn reveal frames come while the reveal still
+ // rides, so the reversal still finds it.
+ requireFrames(
+ result.frames.filter(f => f.phase.startsWith('opening')),
+ {
+ min: 2,
+ during: 'the reveal plays',
+ where: f => f.phase === 'opening',
+ },
+ );
// With those two, the conceal's 6 make the 8 drawn reads this proof always
// required: its 9 shown reads included the held reversal.
- requireFrames(result.frames, {
- min: 6,
- during: 'the conceal plays',
- where: f => f.phase === 'closing' && f.shown > 0.5,
- });
+ requireFrames(
+ result.frames.filter(f => f.phase.startsWith('closing')),
+ {
+ min: 6,
+ during: 'the conceal plays',
+ where: f => f.phase === 'closing' && f.shown > 0.5,
+ },
+ );
const reversed = result.frames.find(f => f.phase === 'reversed');
expect(reversed?.shown).toBeGreaterThan(2);
expect(reversed?.shown).toBeLessThan(result.height - 2);