28 lines
1.2 KiB
TypeScript
28 lines
1.2 KiB
TypeScript
import { describe, expect, it, vi } from "bun:test";
|
|
import { InputController } from "@oh-my-pi/pi-coding-agent/modes/controllers/input-controller";
|
|
import type { InteractiveModeContext } from "@oh-my-pi/pi-coding-agent/modes/types";
|
|
|
|
describe("InputController tool output expansion", () => {
|
|
it("expands children and forces a full display reset to bypass frozen snapshots", () => {
|
|
const expandable = { setExpanded: vi.fn() };
|
|
const inert = { render: vi.fn(() => []) };
|
|
const requestRender = vi.fn();
|
|
const resetDisplay = vi.fn();
|
|
const ctx = {
|
|
toolOutputExpanded: false,
|
|
chatContainer: { children: [expandable, inert] },
|
|
ui: { requestRender, resetDisplay },
|
|
} as unknown as InteractiveModeContext;
|
|
|
|
new InputController(ctx).toggleToolOutputExpansion();
|
|
|
|
expect(ctx.toolOutputExpanded).toBe(true);
|
|
expect(expandable.setExpanded).toHaveBeenCalledWith(true);
|
|
// resetDisplay() is the only path that retires the transcript's frozen
|
|
// block snapshots and re-emits the whole transcript at its new heights.
|
|
// A plain requestRender would replay the stale (collapsed) snapshots.
|
|
expect(resetDisplay).toHaveBeenCalledTimes(1);
|
|
expect(requestRender).not.toHaveBeenCalled();
|
|
});
|
|
});
|