fix(webui): unify settings switch styles

This commit is contained in:
Xubin Ren committed 2026-09-19 17:59:17 +08:00
1 parent af43292f6f
commit 70bf433018
7 files changed
+105 -53

No files matched your search

+11
View File
@@ -502,6 +502,7 @@ describe("Settings models", () => {
const enableSwitch = within(codexRow).getByRole("switch", { name: "Enable preset" });
expect(enableSwitch).not.toBeChecked();
expect(enableSwitch).toHaveClass("h-5", "w-9", "bg-muted-foreground/25");
fireEvent.click(enableSwitch);
await waitFor(() => {
@@ -516,6 +517,16 @@ describe("Settings models", () => {
expect(
within(enabledCodexRow).getByRole("switch", { name: "Disable preset" }),
).toBeChecked();
expect(within(enabledCodexRow).getByRole("switch")).toHaveClass("h-5", "w-9", "bg-foreground");
});
it("does not allow disabling the last preset", () => {
renderSettingsView({ initialSection: "models", initialSettings: settingsPayload() });
const toggle = screen.getByRole("switch", { name: "Disable preset" });
expect(toggle).toBeChecked();
expect(toggle).toBeDisabled();
fireEvent.click(toggle);
expect(requestMutationMock).not.toHaveBeenCalled();
});
it("appends a new model preset to the call order immediately", async () => {