import "@testing-library/jest-dom/vitest"; import { cleanup } from "@solidjs/testing-library"; import { afterEach, vi } from "vitest"; // jsdom ships HTMLDialogElement without the modal methods BrewFormPage uses for // its inline create dialog, so mirror the open attribute those calls toggle. if (typeof HTMLDialogElement !== "undefined") { if (!HTMLDialogElement.prototype.showModal) { HTMLDialogElement.prototype.showModal = function showModal( this: HTMLDialogElement, ) { this.setAttribute("open", ""); }; } if (!HTMLDialogElement.prototype.close) { HTMLDialogElement.prototype.close = function close( this: HTMLDialogElement, ) { this.removeAttribute("open"); }; } } // jsdom has no layout, so its scrollTo only logs "not implemented". window.scrollTo = () => {}; afterEach(() => { cleanup(); vi.unstubAllGlobals(); vi.restoreAllMocks(); });