fix: let the repair screen turn the layout plugin back on

This commit is contained in:
LukeGus committed 2026-10-21 11:55:50 -05:00
1 parent 28cb1bc554
commit 53c4e5fe9c
5 files changed
+59 -2

No files matched your search

+29 -1
View File
@@ -53,6 +53,8 @@ vi.mock("@/look/use-look-theme", () => ({
useChooseTheme: () => look.chooseTheme,
}));
const fancy = vi.hoisted(() => ({ enabled: true }));
const manager = vi.hoisted(() => ({
requestUpdate: vi.fn(),
requestInstall: vi.fn(),
@@ -72,7 +74,7 @@ vi.mock("@/plugins/use-plugins-manager", () => ({
id: "fancy-layout",
name: "Fancy",
installed: true,
enabled: true,
enabled: fancy.enabled,
updateAvailable: true,
latestVersion: "1.1.0",
managedByServer: false,
@@ -115,6 +117,7 @@ const onRetry = vi.fn();
beforeEach(() => {
permissions.isAdmin = true;
fancy.enabled = true;
for (const fn of [
...Object.values(look),
...Object.values(manager),
@@ -190,6 +193,31 @@ describe("RepairView", () => {
);
});
it("lets an admin turn the plugin back on and then tries again", async () => {
fancy.enabled = false;
manager.toggle.mockResolvedValue(undefined);
render(
<RepairView
status={{ ...status, reason: "disabled", error: null }}
onRetry={onRetry}
/>,
);
expect(screen.queryByText(/looks\.repair\.disable/)).toBeNull();
fireEvent.click(screen.getByText('looks.repair.enable:{"name":"Fancy"}'));
expect(manager.toggle).toHaveBeenCalledWith(
expect.objectContaining({ id: "fancy-layout", enabled: false }),
);
await waitFor(() => expect(onRetry).toHaveBeenCalled());
});
it("offers to start a failed plugin again", () => {
fancy.enabled = false;
render(<RepairView status={status} onRetry={onRetry} />);
expect(
screen.getByText('looks.repair.startAgain:{"name":"Fancy"}'),
).toBeTruthy();
});
it("lets an admin restore the bundled copy and then tries again", async () => {
render(<RepairView status={status} onRetry={onRetry} />);
fireEvent.click(screen.getByText('looks.repair.restore:{"name":"Fancy"}'));