Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/calm-review-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 2 additions & 0 deletions .changeset/pure-pane-controller.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 2 additions & 0 deletions .changeset/quiet-trust-controller.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
613 changes: 92 additions & 521 deletions src/ui/App.tsx

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions src/ui/AppHost.extension-sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,56 @@ describe("extension sidebar views", () => {
});
});

test("the files toggle closes a built-in fallback injected after availability failure", async () => {
const repo = createTestRepo("hunk-ext-sidebar-availability-failure-");
const extPath = join(createTempDir("hunk-ext-sidebar-availability-failure-ext-"), "ext.ts");
writeFileSync(
extPath,
`import { createElement } from "react";\n` +
`export default function (hunk) {\n` +
` hunk.registerPane({\n` +
` id: "broken-files",\n` +
` placement: "left",\n` +
` replaces: "hunk:files",\n` +
` available: () => { throw new Error("availability exploded"); },\n` +
` component: () => createElement("text", { content: "BROKEN FILES" }),\n` +
` });\n` +
`}\n`,
);

const bootstrap = await launchWithExtension(repo, extPath);
await withAppHost(bootstrap, async (setup) => {
await flushUntil(
setup,
() => setup.captureCharFrame().includes("availability failed"),
"the availability failure warning to appear",
);
await flushUntil(
setup,
() => setup.captureCharFrame().includes("M alpha.txt"),
"the built-in files fallback to appear",
);

await act(async () => {
await setup.mockInput.typeText("s");
});
await flushUntil(
setup,
() => !setup.captureCharFrame().includes("M alpha.txt"),
"the files toggle to close the injected fallback",
);

await act(async () => {
await setup.mockInput.typeText("s");
});
await flushUntil(
setup,
() => setup.captureCharFrame().includes("M alpha.txt"),
"the files toggle to reopen the built-in files pane",
);
});
});

test("reevaluates pane availability when filtering changes visible files", async () => {
const repo = createTestRepo("hunk-ext-pane-availability-");
const extPath = join(createTempDir("hunk-ext-pane-availability-ext-"), "ext.ts");
Expand Down
Loading
Loading