Skip to content

Commit 6aa4fb7

Browse files
committed
test(ui): cover deferred skills dialog opening
1 parent 69f03f1 commit 6aa4fb7

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

ui/src/ui/views/skills.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,25 @@ describe("renderSkills", () => {
9898
}
9999
});
100100

101+
it("defers detail dialog opening until the dialog is connected", async () => {
102+
const container = document.createElement("div");
103+
const showModal = vi.fn(function (this: HTMLDialogElement) {
104+
expect(this.isConnected).toBe(true);
105+
this.setAttribute("open", "");
106+
});
107+
108+
installDialogMethod("showModal", showModal);
109+
110+
render(renderSkills(createProps({ detailKey: "repo-skill" })), container);
111+
document.body.append(container);
112+
dialogRestores.push(() => container.remove());
113+
114+
await Promise.resolve();
115+
116+
expect(showModal).toHaveBeenCalledTimes(1);
117+
expect(container.querySelector("dialog")?.hasAttribute("open")).toBe(true);
118+
});
119+
101120
it("opens detail dialogs and routes ClawHub actions", async () => {
102121
const container = document.createElement("div");
103122
document.body.append(container);

0 commit comments

Comments
 (0)