An open source design system that's fully customizable and agent ready
TypeScript
test(DropdownMenu): the SSR test waits for the on-demand sheet before it ends (#8492)
Cindy Zhangd484045d5950
diff --git a/packages/core/src/DropdownMenu/DropdownMenu.ssr.test.tsx b/packages/core/src/DropdownMenu/DropdownMenu.ssr.test.tsxindex 7d5ed33f4b..be93b5a20f 100644--- a/packages/core/src/DropdownMenu/DropdownMenu.ssr.test.tsx+++ b/packages/core/src/DropdownMenu/DropdownMenu.ssr.test.tsx@@ -5,7 +5,8 @@* @input DropdownMenu server markup and React hydration* @output Proves a bottom-sheet DropdownMenu hydrates without a recoverable* error while its on-demand sheet has not loaded (spec:AST-013 FR9)- * @position SSR acceptance test for DropdownMenu+ * @position SSR acceptance test for DropdownMenu; it waits for the on-demand+ * sheet modules each hydration starts, so none loads after teardown*/import {act} from 'react';@@ -41,6 +42,15 @@ async function serverRenderThenHydrate(): Promise<unknown[]> {onRecoverableError: error => recoverableErrors.push(error),});});+ // Right after hydration the sheet wrappers render and start loading the+ // sheet on demand. Finish those loads before the test ends, or they+ // resolve after this file's environment is torn down.+ await act(async () => {+ await Promise.all([+ import('./MenuBottomSheet'),+ import('./MenuBottomSheetActionList'),+ ]);+ });await act(async () => {root.unmount();});