|
9 | 9 | type ScopedThreadRef, |
10 | 10 | } from "@t3tools/contracts"; |
11 | 11 | import { DEFAULT_CLIENT_SETTINGS } from "@t3tools/contracts/settings"; |
12 | | -import { Suspense, type ComponentProps, type ReactElement, type ReactNode } from "react"; |
| 12 | +import { use, Suspense, type ComponentProps, type ReactElement, type ReactNode } from "react"; |
13 | 13 | import { describe, expect, it, vi } from "vite-plus/test"; |
14 | 14 |
|
15 | 15 | import { useComposerDraftStore } from "~/composerDraftStore"; |
@@ -71,6 +71,7 @@ vi.mock("~/hooks/useSettings", () => ({ |
71 | 71 | select(DEFAULT_CLIENT_SETTINGS), |
72 | 72 | useEnvironmentSettings: () => undefined, |
73 | 73 | })); |
| 74 | +vi.mock("~/commandPaletteBus", () => ({ isCommandPaletteOpen: () => false })); |
74 | 75 | vi.mock("~/hooks/useLiveRefresh", () => ({ useLiveRefresh: () => {} })); |
75 | 76 | vi.mock("~/hooks/useHandleNewThread", () => ({ useNewThreadHandler: () => vi.fn() })); |
76 | 77 | vi.mock("~/state/sourceControlActions", () => ({ |
@@ -136,6 +137,7 @@ vi.mock("~/components/ui/menu", () => ({ |
136 | 137 | MenuGroup: Wrapper, |
137 | 138 | MenuTrigger: Trigger, |
138 | 139 | MenuItem: "button", |
| 140 | + MenuCheckboxItem: "button", |
139 | 141 | MenuRadioGroup: Wrapper, |
140 | 142 | MenuRadioItem: "button", |
141 | 143 | MenuSeparator: () => null, |
@@ -166,8 +168,13 @@ vi.mock("~/components/pullRequest/PullRequestGuideTab", () => ({ |
166 | 168 | PullRequestGuideTab: () => null, |
167 | 169 | })); |
168 | 170 | vi.mock("./PullRequestSidePanel", async (importOriginal) => { |
169 | | - await bodyImport.promise; |
170 | | - return importOriginal(); |
| 171 | + const { default: Body } = await importOriginal<typeof import("./PullRequestSidePanel")>(); |
| 172 | + return { |
| 173 | + default: function DeferredBody(props: ComponentProps<typeof Body>) { |
| 174 | + use(bodyImport.promise); |
| 175 | + return <Body {...props} />; |
| 176 | + }, |
| 177 | + }; |
171 | 178 | }); |
172 | 179 |
|
173 | 180 | import { RegisteredSidePanel } from "../bundledPanels"; |
@@ -286,7 +293,7 @@ const isLoading = (screen: Screen) => |
286 | 293 |
|
287 | 294 | describe("pull request side panel", () => { |
288 | 295 | // Runs first, while the body's code is still held back. |
289 | | - it("shows the pull request loading state until its code arrives", async () => { |
| 296 | + it("shows the pull request loading state until its body is ready", async () => { |
290 | 297 | resetFixture(); |
291 | 298 | await using screen = await renderScreen(null, { router: false }); |
292 | 299 | await renderFor(screen, refOn("environment-new")); |
|
0 commit comments