mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 16:04:21 +00:00
Increase/Decrease/Reset Font Size and Ctrl/Cmd+mouse wheel (when enabled) zoom the focused Agent chat tab, New Task tab or docked Agent tool window on its own (-6..+36 px): prose, code, reference chips, tool cards, prompts, the composer, Mermaid diagrams and images scale together, and off-screen virtualized rows are re-measured. Reset Font Size resets only the focused Agent surface. svgSize moves to src/ui, shared by the Markdown viewer and agents. Co-authored-by: dengliu <5108773+dengliu@users.noreply.github.com>
45 lines
1.7 KiB
TypeScript
45 lines
1.7 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 tabClose = vi.fn();
|
|
const dispose = registerEditorKind({
|
|
kind: "close-probe",
|
|
title: () => "Probe",
|
|
component: () => null,
|
|
onClose: close,
|
|
onTabClose: tabClose,
|
|
});
|
|
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);
|
|
const firstTabId = panes[0]!.tabs[0]!.id;
|
|
const secondTabId = panes[1]!.tabs[0]!.id;
|
|
await controller.closeTab(panes[0]!.id, firstTabId);
|
|
expect(tabClose).toHaveBeenCalledExactlyOnceWith(firstTabId, input);
|
|
expect(close).not.toHaveBeenCalled();
|
|
await controller.closeInput(input.key);
|
|
expect(tabClose).toHaveBeenCalledTimes(2);
|
|
expect(tabClose).toHaveBeenLastCalledWith(secondTabId, input);
|
|
expect(close).toHaveBeenCalledExactlyOnceWith(input);
|
|
} finally {
|
|
dispose();
|
|
}
|
|
});
|
|
});
|