Skip to content

Commit

Permalink
Fix broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
glendaviesnz committed Mar 12, 2023
1 parent d9e798f commit 500cec3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/block-library/src/cover/test/block-controls.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 500cec3

Please sign in to comment.