diff --git a/ui/src/ui/views/sessions.test.ts b/ui/src/ui/views/sessions.test.ts index 62367dfc2c9..6ecbf1911b9 100644 --- a/ui/src/ui/views/sessions.test.ts +++ b/ui/src/ui/views/sessions.test.ts @@ -65,55 +65,7 @@ function buildProps(result: SessionsListResult): SessionsProps { } describe("sessions view", () => { - it("renders verbose=full without falling back to inherit", async () => { - const container = document.createElement("div"); - render( - renderSessions( - buildProps( - buildResult({ - key: "agent:main:main", - kind: "direct", - updatedAt: Date.now(), - verboseLevel: "full", - }), - ), - ), - container, - ); - await Promise.resolve(); - - const selects = container.querySelectorAll("select"); - const verbose = selects[2] as HTMLSelectElement | undefined; - expect(verbose?.value).toBe("full"); - expect(Array.from(verbose?.options ?? []).some((option) => option.value === "full")).toBe(true); - }); - - it("keeps unknown stored values selectable instead of forcing inherit", async () => { - const container = document.createElement("div"); - render( - renderSessions( - buildProps( - buildResult({ - key: "agent:main:main", - kind: "direct", - updatedAt: Date.now(), - reasoningLevel: "custom-mode", - }), - ), - ), - container, - ); - await Promise.resolve(); - - const selects = container.querySelectorAll("select"); - const reasoning = selects[3] as HTMLSelectElement | undefined; - expect(reasoning?.value).toBe("custom-mode"); - expect( - Array.from(reasoning?.options ?? []).some((option) => option.value === "custom-mode"), - ).toBe(true); - }); - - it("renders explicit fast mode without falling back to inherit", async () => { + it("keeps explicit and unknown session setting values selectable", async () => { const container = document.createElement("div"); render( renderSessions( @@ -123,6 +75,8 @@ describe("sessions view", () => { kind: "direct", updatedAt: Date.now(), fastMode: true, + verboseLevel: "full", + reasoningLevel: "custom-mode", }), ), ), @@ -132,7 +86,15 @@ describe("sessions view", () => { const selects = container.querySelectorAll("select"); const fast = selects[1] as HTMLSelectElement | undefined; + const verbose = selects[2] as HTMLSelectElement | undefined; + const reasoning = selects[3] as HTMLSelectElement | undefined; expect(fast?.value).toBe("on"); + expect(verbose?.value).toBe("full"); + expect(Array.from(verbose?.options ?? []).some((option) => option.value === "full")).toBe(true); + expect(reasoning?.value).toBe("custom-mode"); + expect( + Array.from(reasoning?.options ?? []).some((option) => option.value === "custom-mode"), + ).toBe(true); }); it("deselects only the current page from the header checkbox", async () => { diff --git a/ui/src/ui/views/skills.test.ts b/ui/src/ui/views/skills.test.ts index f222d884cf8..52011095f3b 100644 --- a/ui/src/ui/views/skills.test.ts +++ b/ui/src/ui/views/skills.test.ts @@ -98,34 +98,14 @@ describe("renderSkills", () => { } }); - it("opens the skill detail dialog as a modal", async () => { + it("opens the skill detail dialog as a modal and routes close events", async () => { const container = document.createElement("div"); + const onDetailClose = vi.fn(); const showModal = vi.fn(function (this: HTMLDialogElement) { this.setAttribute("open", ""); }); + installDialogMethod("showModal", showModal); - - render( - renderSkills( - createProps({ - detailKey: "repo-skill", - }), - ), - container, - ); - await Promise.resolve(); - - expect(showModal).toHaveBeenCalledTimes(1); - expect(container.querySelector("dialog")?.hasAttribute("open")).toBe(true); - }); - - it("closes the skill detail dialog through the dialog close event", async () => { - const container = document.createElement("div"); - const onDetailClose = vi.fn(); - - installDialogMethod("showModal", function (this: HTMLDialogElement) { - this.setAttribute("open", ""); - }); installDialogMethod("close", function (this: HTMLDialogElement) { this.removeAttribute("open"); this.dispatchEvent(new Event("close")); @@ -142,6 +122,9 @@ describe("renderSkills", () => { ); await Promise.resolve(); + expect(showModal).toHaveBeenCalledTimes(1); + expect(container.querySelector("dialog")?.hasAttribute("open")).toBe(true); + container.querySelector(".md-preview-dialog__header .btn")?.click(); expect(onDetailClose).toHaveBeenCalledTimes(1);