feat(tui): collapse directories when possible in file tree (#28512)

This commit is contained in:
James Long
2026-05-20 16:22:04 -04:00
committed by GitHub
parent 650594e801
commit d0779d2aca
4 changed files with 129 additions and 28 deletions

View File

@@ -89,8 +89,8 @@ describe("DiffViewerFileTree", () => {
await renderFrame(() => <DiffViewerFileTree files={files} loading={false} error={undefined} theme={theme} />),
)
expect(focused).toContain("▾ src")
expect(unfocused).toContain("▾ src")
expect(focused).toContain("▾ src/config")
expect(unfocused).toContain("▾ src/config")
expect(focused.some((line) => line.includes("*"))).toBe(false)
expect(unfocused.some((line) => line.includes("*"))).toBe(false)
})
@@ -108,7 +108,7 @@ describe("DiffViewerFileTree", () => {
<DiffViewerFileTree files={files} loading={false} error={undefined} theme={theme} expandedNodes={collapsed} />
)),
),
).toEqual(["▸ src", " README.md"])
).toEqual(["▸ src/config", " README.md"])
expect(
visibleLines(
@@ -122,7 +122,7 @@ describe("DiffViewerFileTree", () => {
/>
)),
),
).toEqual(["▾ src", " ▾ config", " tui.ts", " README.md"])
).toEqual(["▾ src/config", " tui.ts", " README.md"])
})
})