Files
reader/web/test/setup.ts
T

13 lines
781 B
TypeScript

// React 19 requires this flag for deterministic act() behavior in the legacy
// Screen tests while those tests are being migrated to React Testing Library.
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
if (typeof HTMLDialogElement !== 'undefined') {
HTMLDialogElement.prototype.showModal ??= function showModal() { this.setAttribute('open', ''); };
HTMLDialogElement.prototype.close ??= function close() { this.removeAttribute('open'); };
}
if (typeof window !== 'undefined' && !window.matchMedia) {
window.matchMedia = (() => ({ matches: false, media: '', onchange: null, addListener() {}, removeListener() {}, addEventListener() {}, removeEventListener() {}, dispatchEvent() { return false; } })) as typeof window.matchMedia;
}