Files
openidea/src/editor/core/inputClose.test.ts
T
Shohruh Ismoilovandshohruh-genius 9f2e6b570f feat(vcs): correct Git log graph projection and expand history views (#1076)
Git Log could lose commits when filtering by several paths, draw wrong
ancestry after filtering or collapsing rows, and open the wrong
repository in multi-root views. The graph is now projected over the full
commit DAG and laid out in Bek order, so filtered and collapsed views keep
the real ancestry; each log view keeps its own filters and requests.

Commit metadata, messages and path changes are kept in a persistent index
(by object id, in the IDE's cache directory) with seekable paging, and the
log gains parent-aware merge comparisons, a lazy revision browser,
read-only logs of repositories outside the project (opened with command
execution disabled), commit bookmarks, configurable built-in columns and
batched commit details. The adapted IntelliJ algorithms are attributed in
THIRD_PARTY_LICENSES.md.

Closes #872

Co-authored-by: shohruh-genius <[email protected]>
2026-11-05 02:31:32 +08:00

38 lines
1.4 KiB
TypeScript

import { afterEach, describe, expect, it, vi } from "vitest";
import { registerEditorKind } from "@/workbench/contributions";
import { EditorController, useTabs } from "./controller";
import { createMemoryBackend } from "./backend";
import { initialTabsState } from "./model/tabs";
let controller: EditorController | null = null;
afterEach(() => {
controller?.stop();
controller = null;
useTabs.setState(initialTabsState(), true);
});
describe("custom editor close lifecycle", () => {
it("notifies once when the last split showing an input closes", async () => {
const close = vi.fn();
const dispose = registerEditorKind({
kind: "close-probe",
title: () => "Probe",
component: () => null,
onClose: close,
});
controller = new EditorController(createMemoryBackend({}));
controller.start();
const input = { kind: "close-probe", key: "close-probe:1" };
try {
await controller.openInput(input);
controller.split(useTabs.getState().activePane, "row");
const panes = Object.values(useTabs.getState().panes);
expect(panes).toHaveLength(2);
await controller.closeTab(panes[0]!.id, panes[0]!.tabs[0]!.id);
expect(close).not.toHaveBeenCalled();
await controller.closeInput(input.key);
expect(close).toHaveBeenCalledExactlyOnceWith(input);
} finally {
dispose();
}
});
});