Align dictation controls with settings dropdowns and show setup guidance

This commit is contained in:
amosblomqvist
2026-10-27 22:18:01 +02:00
parent f5a655b2f9
commit 27e277099f
8 changed files with 100 additions and 45 deletions
+29
View File
@@ -19,6 +19,8 @@ import { KeyboardSection } from "../components/settings/keyboard-section.tsx";
import type { GraphSettings } from "../src/core/index.ts";
import { SettingsDialogBody, SettingsDialogProvider } from "../components/settings/settings-dialog.tsx";
import { KEYBOARD_ACTIONS } from "../src/core/index.ts";
import { DictationLanguageSetting } from "../components/dictation-language.tsx";
import { SettingsMenuTrigger } from "../components/settings/controls.tsx";
/** The full opening tag of the element carrying a testid — attribute
* order in React output is not contractual, so assertions run on the
@@ -60,6 +62,33 @@ describe("SettingsDialog (the designed surface, SSR)", () => {
});
});
describe("the shared settings dropdown trigger", () => {
it("Agent, Appearance and dictation use the same compact dark mono trigger", () => {
const surfaces = [
[renderToStaticMarkup(<AgentSection agent={undefined} models={undefined} graph={undefined} onSectionChange={() => {}} onModelsChange={() => {}} />), "slot-model-strong"],
[renderToStaticMarkup(<AppearanceSection appearance={undefined} onSectionChange={() => {}} />), "font-trigger"],
[renderToStaticMarkup(<DictationLanguageSetting />), "dictation-language"],
] as const;
for (const [html, id] of surfaces) {
const tag = tagOf(html, id);
const classes = tag.match(/class="([^"]+)"/)![1]!.split(" ");
for (const token of ["h-7", "rounded-sm", "border", "border-border", "bg-background", "px-1.5", "font-ui", "text-xs", "hover:border-muted-foreground/50"]) {
assert.ok(classes.includes(token), `${id}: ${token}`);
}
assert.ok(html.includes("▾"), `${id}: shared dropdown indicator`);
}
});
it("preserves native disabling separately from callers' existing click-gated unavailable state", () => {
const disabled = tagOf(renderToStaticMarkup(<SettingsMenuTrigger value="English" disabled data-testid="disabled-trigger" />), "disabled-trigger");
const unavailable = tagOf(renderToStaticMarkup(<SettingsMenuTrigger value="Automatic" unavailable data-testid="unavailable-trigger" />), "unavailable-trigger");
assert.ok(disabled.includes('disabled=""'));
assert.ok(!unavailable.includes('disabled=""'));
assert.ok(unavailable.includes("cursor-not-allowed"));
assert.ok(!unavailable.includes("hover:border-muted-foreground/50"));
});
});
describe("AgentSection (thin SSR)", () => {
it("renders the three model SLOT rows (slots-only, fix wave: unpicked reads —, no Default option)", () => {
const html = renderToStaticMarkup(<AgentSection agent={undefined} models={undefined} graph={undefined} onSectionChange={() => {}} onModelsChange={() => {}} />);