mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:20:43 +00:00
test(ui): cover deferred skills dialog opening
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user