Skip to content

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

TypeScript

test(ChatComposerInput): make the hidden-menu Escape test deterministic (#7581)

Cindy Zhangf789da0f78d0
diff --git a/packages/core/src/Chat/ChatComposerInput.test.tsx b/packages/core/src/Chat/ChatComposerInput.test.tsx
index 52429847cc..ae0455074e 100644
--- a/packages/core/src/Chat/ChatComposerInput.test.tsx
+++ b/packages/core/src/Chat/ChatComposerInput.test.tsx
@@ -1556,6 +1556,10 @@ describe('ChatComposerInput', () => {
await waitFor(() => {
expect(editable).toHaveAttribute('aria-expanded', 'false');
});
+ // The hidden menu's results commit outside act, so the popover's Escape
+ // registration is released by a passive effect that can still be pending
+ // when the attribute changes. Flush it before pressing Escape.
+ await act(async () => {});
// Nothing cancels the key: the closed menu holds no Escape handling,
// so a surrounding dialog or drawer still receives it.