Files
cunningham/packages/react/src/tests/HTMLDialogElementMock.ts
Nathan Vasse 7dcf08d308 🤡(react) add HTMLDialog mock
As JestDOM does not mock this element, we need to do it in order to
make Modal work in test environement.
2024-02-05 15:23:03 +01:00

18 lines
342 B
TypeScript

HTMLDialogElement.prototype.show = vi.fn(function mock(
this: HTMLDialogElement,
) {
this.open = true;
});
HTMLDialogElement.prototype.showModal = vi.fn(function mock(
this: HTMLDialogElement,
) {
this.open = true;
});
HTMLDialogElement.prototype.close = vi.fn(function mock(
this: HTMLDialogElement,
) {
this.open = false;
});