Remember the thread list's dragged width across runs

Kept in layout.json next to the config, as the web keeps its sidebar
width in browser storage. Tests now write to a scratch config folder.
This commit is contained in:
Callum Alpass committed 2026-11-02 23:15:33 +11:00
1 parent 320dbf492d
commit 81a1ee942c
5 files changed
+81 -8

No files matched your search

+13
View File
@@ -1,6 +1,7 @@
import { afterEach, describe, expect, test } from "bun:test";
import { withApproval, withQuestion } from "./fixtures.ts";
import { loadLayout } from "../../src/layout.ts";
import { fakeSession, renderApp, v2ThreadId } from "./harness.tsx";
let app: Awaited<ReturnType<typeof renderApp>> | null = null;
@@ -283,4 +284,16 @@ describe("mouse", () => {
await app.click(before + 10, 10, 2);
expect(app.find("│").x).toBe(before);
});
test("the list keeps its dragged width for the next run", async () => {
const first = await open();
const before = first.find("│").x;
await first.mockMouse.drag(before, 10, before + 7, 10);
await first.settle(100);
first.destroy();
const layout = await loadLayout();
expect(layout.listWidth).toBe(before + 7);
const next = await open({ layout });
expect(next.find("│").x).toBe(before + 7);
});
});