test(ui): cover deferred skills dialog opening

This commit is contained in:
Peter Steinberger
2026-05-03 15:19:44 +01:00
parent 69f03f134f
commit 6aa4fb7a69

View File

@@ -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);