25 lines
445 B
TypeScript
25 lines
445 B
TypeScript
|
let listener: ((rect: any) => void) | undefined = undefined;
|
||
|
const mockDisconnect = jest.fn();
|
||
|
|
||
|
class ResizeObserver {
|
||
|
|
||
|
constructor(ls: any) {
|
||
|
listener = ls;
|
||
|
}
|
||
|
|
||
|
observe() {
|
||
|
// do nothing
|
||
|
}
|
||
|
unobserve() {
|
||
|
// do nothing
|
||
|
}
|
||
|
disconnect() {
|
||
|
mockDisconnect();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// eslint-disable-next-line compat/compat
|
||
|
(window as any).ResizeObserver = ResizeObserver;
|
||
|
|
||
|
export { ResizeObserver as default, listener, mockDisconnect };
|