9bcb923cc0
* feat: add risk warning modal WIP * feat: add risk notice modal and fix broken mobile dialog styles * fix: format * fix: lint * fix: format * fix: dialog scrollbar * fix: style issues * fix: styles * fix: spacing * fix: more style fixes * fix: more spacing * fix: format * fix: move logic into risk dialog from global app * fix: brance yourselves, more style updates * feat: add test for risk dialog
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import '@testing-library/jest-dom';
|
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
|
|
global.ResizeObserver = ResizeObserver;
|
|
|
|
// Required by radix-ui/react-tooltip
|
|
global.DOMRect = class DOMRect {
|
|
bottom = 0;
|
|
left = 0;
|
|
right = 0;
|
|
top = 0;
|
|
|
|
constructor(
|
|
public x = 0,
|
|
public y = 0,
|
|
public width = 0,
|
|
public height = 0
|
|
) {}
|
|
static fromRect(other?: DOMRectInit): DOMRect {
|
|
return new DOMRect(other?.x, other?.y, other?.width, other?.height);
|
|
}
|
|
toJSON() {
|
|
return JSON.stringify(this);
|
|
}
|
|
};
|
|
|
|
// Based on the official jest docs
|
|
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
|
|
Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: jest.fn().mockImplementation((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: jest.fn(), // Deprecated
|
|
removeListener: jest.fn(), // Deprecated
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn(),
|
|
})),
|
|
});
|