mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 22:40:42 +00:00
test: require modal dialog helpers
This commit is contained in:
@@ -60,12 +60,18 @@ async function renderModal() {
|
||||
container,
|
||||
);
|
||||
const modal = container.querySelector<OpenClawModalDialog>("openclaw-modal-dialog");
|
||||
expect(modal).not.toBeNull();
|
||||
await modal!.updateComplete;
|
||||
expect(modal).toBeInstanceOf(HTMLElement);
|
||||
if (!modal) {
|
||||
throw new Error("Expected openclaw-modal-dialog");
|
||||
}
|
||||
await modal.updateComplete;
|
||||
await nextFrame();
|
||||
const dialog = modal!.shadowRoot?.querySelector("dialog");
|
||||
expect(dialog).not.toBeNull();
|
||||
return { modal: modal!, dialog: dialog! };
|
||||
const dialog = modal.shadowRoot?.querySelector("dialog");
|
||||
expect(dialog).toBeInstanceOf(HTMLDialogElement);
|
||||
if (!(dialog instanceof HTMLDialogElement)) {
|
||||
throw new Error("Expected rendered dialog");
|
||||
}
|
||||
return { modal, dialog };
|
||||
}
|
||||
|
||||
describe("openclaw-modal-dialog", () => {
|
||||
|
||||
@@ -50,12 +50,18 @@ function restoreDescriptor(name: "showModal" | "close", descriptor?: PropertyDes
|
||||
|
||||
async function getRenderedDialog() {
|
||||
const modal = container.querySelector<OpenClawModalDialog>("openclaw-modal-dialog");
|
||||
expect(modal).not.toBeNull();
|
||||
await modal!.updateComplete;
|
||||
expect(modal).toBeInstanceOf(HTMLElement);
|
||||
if (!modal) {
|
||||
throw new Error("Expected openclaw-modal-dialog");
|
||||
}
|
||||
await modal.updateComplete;
|
||||
await nextFrame();
|
||||
const dialog = modal!.shadowRoot?.querySelector("dialog");
|
||||
expect(dialog).not.toBeNull();
|
||||
return { modal: modal!, dialog: dialog! };
|
||||
const dialog = modal.shadowRoot?.querySelector("dialog");
|
||||
expect(dialog).toBeInstanceOf(HTMLDialogElement);
|
||||
if (!(dialog instanceof HTMLDialogElement)) {
|
||||
throw new Error("Expected rendered dialog");
|
||||
}
|
||||
return { modal, dialog };
|
||||
}
|
||||
|
||||
function dispatchEscape(target: EventTarget) {
|
||||
|
||||
Reference in New Issue
Block a user