diff --git a/test/unit/config/global-mocks.js b/test/unit/config/global-mocks.js index 8fac04b2151ad6..84ec5acbe91923 100644 --- a/test/unit/config/global-mocks.js +++ b/test/unit/config/global-mocks.js @@ -19,3 +19,12 @@ if ( ! window.wp?.galleryBlockV2Enabled ) { } global.ResizeObserver = require( 'resize-observer-polyfill' ); + +/** + * The following mock is for block integration tests that might render + * components leveraging DOMRect. For example, the Cover block which now renders + * its ResizableBox control via the BlockPopover component. + */ +if ( ! window.DOMRect ) { + window.DOMRect = class DOMRect {}; +}