/** * jsdom doesn't implement HTMLDialogElement.showModal/close. * Call this in beforeAll() for tests that render . */ export function polyfillDialog(): void { if (typeof HTMLDialogElement.prototype.showModal !== "function") { HTMLDialogElement.prototype.showModal = function showModal() { this.setAttribute("open", ""); }; } if (typeof HTMLDialogElement.prototype.close !== "function") { HTMLDialogElement.prototype.close = function close() { this.removeAttribute("open"); }; } }