From c8106099d4147e7fff516f65720638f8bbb96406 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Fri, 2 Sep 2022 11:21:25 +0300 Subject: [PATCH] Add an accessible title to the query --- .../src/components/preferences-modal/test/index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/edit-post/src/components/preferences-modal/test/index.js b/packages/edit-post/src/components/preferences-modal/test/index.js index 4a157fd36c263..b2ab5ae2465cf 100644 --- a/packages/edit-post/src/components/preferences-modal/test/index.js +++ b/packages/edit-post/src/components/preferences-modal/test/index.js @@ -24,19 +24,25 @@ describe( 'EditPostPreferencesModal', () => { useSelect.mockImplementation( () => true ); useViewportMatch.mockImplementation( () => true ); render( ); - expect( screen.getByRole( 'dialog' ) ).toMatchSnapshot(); + expect( + screen.getByRole( 'dialog', { name: 'Preferences' } ) + ).toMatchSnapshot(); } ); it( 'small viewports', () => { useSelect.mockImplementation( () => true ); useViewportMatch.mockImplementation( () => false ); render( ); - expect( screen.getByRole( 'dialog' ) ).toMatchSnapshot(); + expect( + screen.getByRole( 'dialog', { name: 'Preferences' } ) + ).toMatchSnapshot(); } ); } ); it( 'should not render when the modal is not active', () => { useSelect.mockImplementation( () => false ); render( ); - expect( screen.queryByRole( 'dialog' ) ).not.toBeInTheDocument(); + expect( + screen.queryByRole( 'dialog', { name: 'Preferences' } ) + ).not.toBeInTheDocument(); } ); } );