fix(design): claim audit part 1b — whole-row switches, the field-family edge, state-layer hovers, icon links, reason-disabled controls, 24/44 targets (E28)
- F12 (owner: A): SwitchRow, the whole settings row toggles; a Config boolean toggles from its title and hint (a label pointed at the switch). - F14 (owner: B): the form dropdown trigger wears the field frame (see-through, the >= 3:1 edge); labelled pills keep the faint edge and the accent-edge hover. DESIGN says so, with log rows. - F6: ~15 bg-card / bg-border / opacity hovers onto the B3 state layer; a lint rule (HOVER_SWAP) refuses the swap, contract-tested. - F10: bare 14px icon links onto IconLink / LinkButton; a local lint rule refuses a glyph-only <a>. - F13: reason-disabled controls are aria-disabled (Users, Channels backfill, Discovery, Scheduler runs, Config tests); FocusSafeButton now swallows the click of a caller's aria-disabled; the Config tests say why while dirty (testDirty, HU/EN). - F5/F11: every control measured live at 24 (mouse) and 44 (coarse) across every page; touch-target is a utility that wins over a caller's min-h-6; link variants carry it too; SegmentedToggle, Tabs, NavRail, menu rows, PriorityStepper, sliders, CheckRow, InnerInput, card links and the rest. - F9: DismissibleChip's label reaches the chip's 24; the Combobox chips are DismissibleChips. - F15: the "+N" / "More..." open state worded as it renders.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// jsdom does no layout, so what is asserted is the class contract those rules rest on, the same
|
||||
// trade SearchBar.dom.test.tsx already makes for the narrow-header rules.
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { cleanup, render, screen } from "@testing-library/react";
|
||||
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import type { ConfigItem } from "../lib/api";
|
||||
|
||||
@@ -42,7 +42,12 @@ vi.mock("../lib/api", async (importOriginal) => {
|
||||
api: {
|
||||
...actual.api,
|
||||
adminConfig: () =>
|
||||
Promise.resolve({ groups: { g: [text("site_name")] }, secrets_manageable: true }),
|
||||
Promise.resolve({
|
||||
groups: {
|
||||
g: [text("site_name"), { ...text("signups_open"), type: "bool", value: "false" }],
|
||||
},
|
||||
secrets_manageable: true,
|
||||
}),
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -73,4 +78,21 @@ describe("ConfigPanel field row (E22 round 2)", () => {
|
||||
expect(control.className).toContain("sm:shrink-0");
|
||||
expect(control.className).not.toMatch(/(^|\s)shrink-0(\s|$)/);
|
||||
});
|
||||
|
||||
it("toggles a boolean key from its title and its hint, not only from the switch (F12)", async () => {
|
||||
render(
|
||||
<QueryClientProvider client={new QueryClient()}>
|
||||
<ConfigPanel />
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
const sw = await screen.findByRole("switch", { name: "config.fields.signups_open.label" });
|
||||
expect(sw.getAttribute("aria-checked")).toBe("false");
|
||||
fireEvent.click(screen.getByText("config.fields.signups_open.label"));
|
||||
expect(sw.getAttribute("aria-checked")).toBe("true");
|
||||
fireEvent.click(screen.getByText("config.fields.signups_open.hint"));
|
||||
expect(sw.getAttribute("aria-checked")).toBe("false");
|
||||
// The switch itself still toggles exactly once, not once more through its label.
|
||||
fireEvent.click(sw);
|
||||
expect(sw.getAttribute("aria-checked")).toBe("true");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user