feat(web): settings form polish — dialog layout, homepage button, no default rows, unified dropdown text (#39)
Co-authored-by: Alice <alice@prismshadow.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* agent-settings-page.ts optionRows unit tests: the runtime dropdowns build from the
|
||||
* dictionary's [value, description] pairs with the "" (inherit) row dropped and dictionary
|
||||
* order kept — pinned so a future reconciliation (e.g. with the no-none branch's option
|
||||
* assembly) cannot silently regress the filter.
|
||||
*/
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { optionRows } from "../src/features/agents/agent-settings-page";
|
||||
|
||||
const ENTRIES: ReadonlyArray<readonly [string, string]> = [
|
||||
["", "Send no override."],
|
||||
["low", "Low tier."],
|
||||
["medium", "Medium tier."],
|
||||
["high", "High tier."],
|
||||
["xhigh", "Extra-high tier."],
|
||||
];
|
||||
|
||||
describe("optionRows", () => {
|
||||
it("drops the '' inherit row and keeps dictionary order", () => {
|
||||
const rows = optionRows(ENTRIES);
|
||||
expect(rows.map((r) => r.value)).toEqual(["low", "medium", "high", "xhigh"]);
|
||||
expect(rows.some((r) => r.value === "")).toBe(false);
|
||||
});
|
||||
|
||||
it("maps value into both labels and carries the description through", () => {
|
||||
const rows = optionRows([["summarize", "Summarize old context."]]);
|
||||
expect(rows[0]).toEqual({
|
||||
value: "summarize",
|
||||
triggerLabel: "summarize",
|
||||
label: "summarize",
|
||||
description: "Summarize old context.",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -63,18 +63,22 @@ describe("thinkingLevelOptionsFor (agent-settings dropdown assembly)", () => {
|
||||
["xhigh", "Extra-high tier."],
|
||||
];
|
||||
|
||||
it("maps the dictionary in order; the '' row renders the default tag; no none row normally", () => {
|
||||
it("filters the '' inherit row and keeps dictionary order; no none row normally", () => {
|
||||
for (const stored of [undefined, "", "medium", "xhigh"]) {
|
||||
const rows = thinkingLevelOptionsFor(OPTIONS, "(default)", "legacy none", stored);
|
||||
expect(rows.map((r) => r.value)).toEqual(["", "low", "medium", "high", "xhigh"]);
|
||||
expect(rows[0]).toMatchObject({ triggerLabel: "(default)", label: "(default)" });
|
||||
const rows = thinkingLevelOptionsFor(OPTIONS, "legacy none", stored);
|
||||
expect(rows.map((r) => r.value)).toEqual(["low", "medium", "high", "xhigh"]);
|
||||
expect(rows.some((r) => r.value === "none")).toBe(false);
|
||||
expect(rows[0]).toMatchObject({
|
||||
triggerLabel: "low",
|
||||
label: "low",
|
||||
description: "Low tier.",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("appends a display-only none row when the persisted config stores none (backward compat)", () => {
|
||||
const rows = thinkingLevelOptionsFor(OPTIONS, "(default)", "legacy none", "none");
|
||||
expect(rows.map((r) => r.value)).toEqual(["", "low", "medium", "high", "xhigh", "none"]);
|
||||
const rows = thinkingLevelOptionsFor(OPTIONS, "legacy none", "none");
|
||||
expect(rows.map((r) => r.value)).toEqual(["low", "medium", "high", "xhigh", "none"]);
|
||||
expect(rows.at(-1)).toEqual({
|
||||
value: "none",
|
||||
triggerLabel: "none",
|
||||
|
||||
Reference in New Issue
Block a user