Skip to content

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

TypeScript

test(core): the edge reveal proofs hold the reveal at fixed times (#10259)

Christopher Chedeau94c87afc402e
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 3ee9d7a56a..33fa1d2d07 100644
--- a/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts
+++ b/packages/core/src/motion/__tests__/animatedLayout.interaction.browser.spec.ts
@@ -2627,8 +2627,13 @@ test.describe('spec:AST-105 FR9 (the edge reveal)', () => {
content.style.display = '';
opening.animate();
window.AnimatedLayout.playLayoutChange(layout, content);
- for (let i = 0; i < 2; i++) {
- await frame();
+ await new Promise<void>(resolve => {
+ queueMicrotask(resolve);
+ });
+ // Hold the reveal at fixed times on its own clock, once it rides. Late
+ // frames then cannot end it before these reads.
+ for (const ms of [20, 40, 60, 80, 100]) {
+ window.holdAt(ms);
read('opening');
}
// Closed again 120 ms into the reveal, as the page shows it then.
@@ -2646,6 +2651,11 @@ test.describe('spec:AST-105 FR9 (the edge reveal)', () => {
});
// Where the conceal starts, on its own clock, before any frame.
read('restart');
+ // Hold the conceal at fixed times too, so late frames cannot skip it.
+ for (const ms of [20, 40, 60, 80, 100]) {
+ window.holdAt(ms);
+ read('closing held');
+ }
window.resumeAll();
for (let i = 0; i < 60; i++) {
await frame();
@@ -2718,8 +2728,13 @@ test.describe('spec:AST-105 FR9 (the edge reveal)', () => {
window.AnimatedLayout.playLayoutChange(layout, content, {
edge: 'inline-end',
});
- for (let i = 0; i < 5; i++) {
- await frame();
+ await new Promise<void>(resolve => {
+ queueMicrotask(resolve);
+ });
+ // Hold the reveal at fixed times on its own clock, once it rides.
+ // Late frames then cannot end it before these reads.
+ for (const ms of [20, 40, 60, 80, 100]) {
+ window.holdAt(ms);
read('opening');
}
// Closed again 120 ms into the reveal, as the page shows it then:
@@ -2742,6 +2757,11 @@ test.describe('spec:AST-105 FR9 (the edge reveal)', () => {
});
// Where the conceal starts, on its own clock, once it rides.
read('restart');
+ // Hold the conceal at fixed times too, so late frames cannot skip it.
+ for (const ms of [20, 40, 60, 80, 100]) {
+ window.holdAt(ms);
+ read('closing held');
+ }
window.resumeAll();
for (let i = 0; i < 60; i++) {
await frame();