The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type * as Electron from "electron"; |
| 2 | import { beforeEach, expect, it, vi } from "vite-plus/test"; |
| 3 | |
| 4 | const switches = vi.hoisted(() => new Set<string>()); |
| 5 | vi.mock("electron", () => ({ |
| 6 | app: { |
| 7 | commandLine: { |
| 8 | hasSwitch: (name: string) => switches.has(name), |
| 9 | appendSwitch: (name: string) => switches.add(name), |
| 10 | removeSwitch: (name: string) => switches.delete(name), |
| 11 | }, |
| 12 | }, |
| 13 | })); |
| 14 | |
| 15 | import { showWindowsCaptureOverlay } from "./WindowsCaptureFeedback.ts"; |
| 16 | |
| 17 | const animationSwitch = "wm-window-animations-disabled"; |
| 18 | |
| 19 | function overlay(showInactive: () => void) { |
| 20 | return { showInactive } as Electron.BaseWindow; |
| 21 | } |
| 22 | |
| 23 | beforeEach(() => { |
| 24 | switches.clear(); |
| 25 | switches.add("unrelated-switch"); |
| 26 | }); |
| 27 | |
| 28 | it("disables Chromium window animation only while showing the capture overlay", () => { |
| 29 | const flagsDuringShow: string[][] = []; |
| 30 | |
| 31 | showWindowsCaptureOverlay(overlay(() => flagsDuringShow.push([...switches]))); |
| 32 | |
| 33 | expect(flagsDuringShow).toEqual([["unrelated-switch", animationSwitch]]); |
| 34 | expect([...switches]).toEqual(["unrelated-switch"]); |
| 35 | }); |