From 1a26542f3c03f711acefa158c01fab80ff6a74de Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 17 Jan 2023 16:42:40 +0800 Subject: [PATCH] Fix broken test --- .../src/cover/test/block-controls.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/cover/test/block-controls.js b/packages/block-library/src/cover/test/block-controls.js index 272322a8f9ea78..9035b0aedba8a8 100644 --- a/packages/block-library/src/cover/test/block-controls.js +++ b/packages/block-library/src/cover/test/block-controls.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { render, screen, within } from '@testing-library/react'; +import { render, screen, within, act } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; // Need to mock the BlockControls wrapper as this requires a slot to run @@ -88,11 +88,14 @@ describe( 'Cover block controls', () => { await user.click( screen.getByLabelText( 'Change content position' ) ); - within( screen.getByRole( 'grid' ) ) - .getByRole( 'gridcell', { - name: 'top left', - } ) - .focus(); + + await act( async () => + within( screen.getByRole( 'grid' ) ) + .getByRole( 'gridcell', { + name: 'top left', + } ) + .focus() + ); expect( setAttributes ).toHaveBeenCalledWith( { contentPosition: 'top left',