Файли
openidea/src/platform/auxWindow.test.ts
T
l0ng-ai 91da88d09d revert(browser): take the Open Local Browser panel out for now (#6027)
The panel needed the workbench to run as a child webview, which on macOS declines key equivalents, so Command shortcuts went to the native menu and many were lost (#5954, #5992). Reverts #5788, #5917 and the #5956 key-monitor workaround; the workbench webview is the window's own view again on every platform. The panel can come back once it no longer needs a child webview.
2026-11-26 10:25:25 +08:00

35 рядки
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { auxiliaryWindow } from "./auxWindow";
import capability from "../../src-tauri/capabilities/default.json";
import bridgeCapability from "../../src-tauri/capabilities/e2e.json";
describe("auxiliaryWindow", () => {
it("reads the kind and parent from the label", () => {
expect(auxiliaryWindow("settings-main")).toEqual({ kind: "settings", parent: "main" });
expect(auxiliaryWindow("settings-project-2")).toEqual({ kind: "settings", parent: "project-2" });
expect(auxiliaryWindow("comparison-main-0")).toEqual({ kind: "comparison", parent: "main" });
expect(auxiliaryWindow("comparison-project-2-14")).toEqual({ kind: "comparison", parent: "project-2" });
expect(auxiliaryWindow("diff-main-0")).toEqual({ kind: "diff", parent: "main" });
expect(auxiliaryWindow("diff-project-2-14")).toEqual({ kind: "diff", parent: "project-2" });
expect(auxiliaryWindow("editor-main-0")).toEqual({ kind: "editor", parent: "main" });
expect(auxiliaryWindow("editor-project-2-14")).toEqual({ kind: "editor", parent: "project-2" });
expect(auxiliaryWindow("deployment-project-2")).toEqual({ kind: "deployment", parent: "project-2" });
});
it.each(["settings", "comparison", "diff", "editor", "deployment"])(
"grants %s windows permission to close",
(kind) => {
expect(capability.windows).toContain(`${kind}-*`);
expect(bridgeCapability.windows).toContain(`${kind}-*`);
expect(capability.permissions).toContain("core:window:allow-close");
expect(capability.permissions).toContain("core:window:allow-destroy");
},
);
it("leaves project windows and malformed labels alone", () => {
for (const label of ["", "main", "project-1", "settings-", "comparison-main", "comparison-main-x"]) {
expect(auxiliaryWindow(label)).toBeNull();
}
});
});