fix: follow up config.patch restarts/docs/tests (#1653)

* fix: land config.patch restarts/docs/tests (#1624) (thanks @Glucksberg)

* docs: update changelog entry for config.patch follow-up (#1653) (thanks @Glucksberg)
This commit is contained in:
Peter Steinberger
2026-01-24 23:33:13 +00:00
committed by GitHub
parent 5570e1a946
commit 8e159ab0b7
8 changed files with 141 additions and 27 deletions

View File

@@ -74,6 +74,7 @@ export type AppViewState = {
execApprovalError: string | null;
configLoading: boolean;
configRaw: string;
configRawOriginal: string;
configValid: boolean | null;
configIssues: unknown[];
configSaving: boolean;
@@ -84,6 +85,7 @@ export type AppViewState = {
configSchemaLoading: boolean;
configUiHints: Record<string, unknown>;
configForm: Record<string, unknown> | null;
configFormOriginal: Record<string, unknown> | null;
configFormMode: "form" | "raw";
channelsLoading: boolean;
channelsSnapshot: ChannelsStatusSnapshot | null;

View File

@@ -68,6 +68,34 @@ describe("config view", () => {
expect(saveButton?.disabled).toBe(true);
});
it("disables save and apply when raw is unchanged", () => {
const container = document.createElement("div");
render(
renderConfig({
...baseProps(),
formMode: "raw",
raw: "{\n}\n",
originalRaw: "{\n}\n",
}),
container,
);
const saveButton = Array.from(
container.querySelectorAll("button"),
).find((btn) => btn.textContent?.trim() === "Save") as
| HTMLButtonElement
| undefined;
const applyButton = Array.from(
container.querySelectorAll("button"),
).find((btn) => btn.textContent?.trim() === "Apply") as
| HTMLButtonElement
| undefined;
expect(saveButton).not.toBeUndefined();
expect(applyButton).not.toBeUndefined();
expect(saveButton?.disabled).toBe(true);
expect(applyButton?.disabled).toBe(true);
});
it("switches mode via the sidebar toggle", () => {
const container = document.createElement("div");
const onFormModeChange = vi.fn();