mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
Open in New Window on a project file's tab now opens an editor-only window (editor-<parent>-n) instead of a second project workbench. It shares the parent's documents and language servers; unsaved text, caret and selection move with the tab, and the source tab is removed only after the new window reports ready. Files outside the project keep opening a full window. Review changes: closing the window settles only its own unsaved files (the project window's guard also asked to terminate running processes); Escape no longer closes it; error messages go through the text catalog; the window has its own stylesheet. Closes #4117 Co-authored-by: GGVidal <52431033+GGVidal@users.noreply.github.com>
35 lines
1.8 KiB
TypeScript
35 lines
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();
|
|
}
|
|
});
|
|
});
|