fix: refresh plugin settings after enabling a plugin and match select and disabled bar styling

This commit is contained in:
LukeGus committed 2026-10-06 23:08:21 -05:00
1 parent 27819c477c
commit 8666533162
11 files changed
+136 -56

No files matched your search

@@ -106,6 +106,22 @@ describe("useFeatureSettings", () => {
await waitFor(() => expect(api.getPlugins).toHaveBeenCalled());
expect(result.current).toEqual([]);
});
it("picks up a feature enabled while it is open", async () => {
api.getPlugins.mockResolvedValue([
plugin({ id: "late", name: "Late", enabled: false }),
]);
const { result } = renderHook(() => useFeatureSettings("user"));
await waitFor(() => expect(api.getPlugins).toHaveBeenCalledTimes(1));
expect(result.current).toEqual([]);
api.getPlugins.mockResolvedValue([plugin({ id: "late", name: "Late" })]);
window.dispatchEvent(new CustomEvent("termix:plugins-changed"));
await waitFor(() =>
expect(result.current.map((p) => p.id)).toEqual(["late"]),
);
});
});
describe("FeatureSettingsSection", () => {
@@ -28,6 +28,7 @@ import { withPluginScope } from "@/plugin-host/scope";
const getPlugins = vi.fn();
vi.mock("@/api/plugins-api", () => ({
PLUGINS_CHANGED_EVENT: "termix:plugins-changed",
getPlugins: () => getPlugins(),
}));