Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): preserve direct localhost navigation #3939

MergedChrrxs(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/3939/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 194 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
194 additions and 0 deletionsapps/web/src/components/preview/PreviewView.test.tsxAdded
View file
@@ -0,0 +1,194 @@
+import { EnvironmentId, ThreadId } from "@t3tools/contracts";
+import { renderToStaticMarkup } from "react-dom/server";
+import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
+​
+const mocks = vi.hoisted(() => ({
+ navigate: vi.fn(async (_tabId: string, _url: string): Promise<void> => undefined),
+ rememberPreviewUrl: vi.fn(),
+ readPreparedConnection: vi.fn(() => ({ httpBaseUrl: "http://172.25.85.75:3773" })),
+ submittedUrl: null as ((url: string) => void) | null,
+ emptyStateUrl: null as ((url: string) => void) | null,
+ showEmptyState: false,
+}));
+​
+vi.mock("~/state/session", () => ({
+ readPreparedConnection: mocks.readPreparedConnection,
+}));
+​
+vi.mock("~/composerDraftStore", () => ({
+ useComposerDraftStore: (
+ select: (store: { addPreviewAnnotation: () => void; addImage: () => void }) => unknown,
+ ) => select({ addPreviewAnnotation: vi.fn(), addImage: vi.fn() }),
+}));
+​
+vi.mock("~/lib/previewAnnotation", () => ({
+ previewAnnotationScreenshotFile: vi.fn(),
+}));
+​
+vi.mock("~/localApi", () => ({
+ ensureLocalApi: vi.fn(),
+}));