From 6aa4fb7a69b26bdc1728901b66a4a85151ca27b5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 3 May 2026 15:19:44 +0100 Subject: [PATCH] test(ui): cover deferred skills dialog opening --- ui/src/ui/views/skills.test.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ui/src/ui/views/skills.test.ts b/ui/src/ui/views/skills.test.ts index ce354ce0f0d..25e1d6f6773 100644 --- a/ui/src/ui/views/skills.test.ts +++ b/ui/src/ui/views/skills.test.ts @@ -98,6 +98,25 @@ describe("renderSkills", () => { } }); + it("defers detail dialog opening until the dialog is connected", async () => { + const container = document.createElement("div"); + const showModal = vi.fn(function (this: HTMLDialogElement) { + expect(this.isConnected).toBe(true); + this.setAttribute("open", ""); + }); + + installDialogMethod("showModal", showModal); + + render(renderSkills(createProps({ detailKey: "repo-skill" })), container); + document.body.append(container); + dialogRestores.push(() => container.remove()); + + await Promise.resolve(); + + expect(showModal).toHaveBeenCalledTimes(1); + expect(container.querySelector("dialog")?.hasAttribute("open")).toBe(true); + }); + it("opens detail dialogs and routes ClawHub actions", async () => { const container = document.createElement("div"); document.body.append(container);