Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): reject clicks in hidden previews #8495

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 9 commits intomain fromt3code/fix-preview-hidden-clicks-3717opened View on GitHub

Showing 18 changed files with 98 additions and 5 deletions (loading 15).

x
0 of 18 viewed, 18 left
60 additions and 0 deletionsapps/desktop/src/ipc/methods/preview.test.tsModified
View file
@@ -94,4 +94,64 @@
}),
).toThrow();
});
+​
+ effectIt.effect("returns the attachment identity used for visibility updates", () =>
+ Effect.gen(function* () {
+ const registerWebview = vi.fn(() => Effect.succeed("preview-attachment-1"));
+ const result = yield* PreviewIpc.registerWebview
+ .handler({ tabId: "tab-1", webContentsId: 42 })
+ .pipe(Effect.provideService(PreviewManager.PreviewManager, { registerWebview } as never));
+​
+ expect(result).toEqual({ attachmentId: "preview-attachment-1" });
+ expect(registerWebview).toHaveBeenCalledWith("tab-1", 42);
+ }),
+ );
+​
+ effectIt.effect("passes exact attachment visibility to the preview manager", () =>
+ Effect.gen(function* () {
+ const setWebviewVisibility = vi.fn(() => Effect.void);
+ yield* PreviewIpc.setWebviewVisibility
+ .handler({
+ tabId: "tab-1",
+ webContentsId: 42,
+ attachmentId: "preview-attachment-1",
+ visible: true,
+ })
+ .pipe(
+ Effect.provideService(PreviewManager.PreviewManager, { setWebviewVisibility } as never),
+ );