update mock to work with react-virtual

This commit is contained in:
Ashley Harrison 2024-09-09 17:02:51 +01:00 committed by renovate[bot]
parent b5d218e06e
commit a6e2962319

View File

@ -88,8 +88,6 @@ throwUnhandledRejections();
// Used by useMeasure
global.ResizeObserver = class ResizeObserver {
//callback: ResizeObserverCallback;
constructor(callback: ResizeObserverCallback) {
setTimeout(() => {
callback(
@ -105,8 +103,11 @@ global.ResizeObserver = class ResizeObserver {
left: 100,
right: 0,
},
target: {},
} as ResizeObserverEntry,
target: {
// Needed for react-virtual to work in tests
getAttribute: () => 1,
},
} as unknown as ResizeObserverEntry,
],
this
);