19 lines
454 B
TypeScript
19 lines
454 B
TypeScript
import { cleanup } from '@testing-library/react';
|
|
import { afterEach } from 'vitest';
|
|
|
|
afterEach(cleanup);
|
|
|
|
// jsdom has `<dialog>` without its modal methods.
|
|
if (typeof HTMLDialogElement !== 'undefined') {
|
|
HTMLDialogElement.prototype.showModal ??= function showModal(
|
|
this: HTMLDialogElement,
|
|
) {
|
|
this.open = true;
|
|
};
|
|
HTMLDialogElement.prototype.close ??= function close(
|
|
this: HTMLDialogElement,
|
|
) {
|
|
this.open = false;
|
|
};
|
|
}
|