Skip to content

Commit fa6b17e

Browse files
test(auth): align preview coverage with synchronous capture
1 parent 923125d commit fa6b17e

1 file changed

Lines changed: 0 additions & 42 deletions

File tree

‎apps/web/src/components/preview/PreviewView.test.tsx‎

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -657,48 +657,6 @@ describe("PreviewView navigation", () => {
657657
}
658658
});
659659

660-
it("keeps a submitted annotation when the picker is toggled during capture", async () => {
661-
const annotation = {
662-
id: "annotation-submitted",
663-
pageUrl: "https://example.com/dashboard",
664-
pageTitle: "Dashboard",
665-
comment: "Tighten this spacing",
666-
elements: [],
667-
regions: [],
668-
strokes: [],
669-
styleChanges: [],
670-
screenshot: null,
671-
createdAt: "2026-09-05T00:00:00.000Z",
672-
};
673-
mocks.pickElement.mockResolvedValue({ annotation, submission: "attach" });
674-
let finishCapture: (() => void) | undefined;
675-
mocks.capturePreviewAnnotationScreenshot.mockImplementationOnce(
676-
() =>
677-
new Promise((resolve) => {
678-
finishCapture = () => resolve({ status: "none" });
679-
}),
680-
);
681-
const document = installTestDom();
682-
const { createRoot } = await import("react-dom/client");
683-
const root = createRoot(document.createElement("div") as unknown as Element);
684-
try {
685-
await act(async () =>
686-
root.render(<PreviewView threadRef={TEST_THREAD_REF} tabId="tab-1" visible />),
687-
);
688-
await act(async () => mocks.toggleAnnotation?.());
689-
expect(finishCapture).toBeDefined();
690-
// The pick is no longer active once the guest has submitted, so this
691-
// starts a new pick instead of cancelling the submitted one.
692-
await act(async () => mocks.toggleAnnotation?.());
693-
expect(mocks.cancelPickElement).not.toHaveBeenCalled();
694-
await act(async () => finishCapture!());
695-
expect(mocks.addPreviewAnnotation).toHaveBeenCalledWith(TEST_THREAD_REF, annotation);
696-
} finally {
697-
await act(async () => root.unmount());
698-
vi.unstubAllGlobals();
699-
}
700-
});
701-
702660
it("does not reopen a cancelled picker after the permission update finishes", async () => {
703661
let finishUpdate: (() => void) | undefined;
704662
mocks.setAnnotationSendEnabled.mockImplementationOnce(

0 commit comments

Comments
 (0)