As JestDOM does not mock this element, we need to do it in order to make Modal work in test environement.
18 lines
342 B
TypeScript
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;
|
|
});
|