Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditPostPreferencesModal: fix intermittently failing tests #53814

Merged
merged 2 commits into from
Aug 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ describe( 'EditPostPreferencesModal', () => {
useSelect.mockImplementation( () => [ true, true, false ] );
useViewportMatch.mockImplementation( () => true );
render( <EditPostPreferencesModal /> );
await screen.findByRole( 'tab', {
name: 'General',
selected: true,
} );
expect(
await screen.findByRole( 'dialog', { name: 'Preferences' } )
screen.getByRole( 'dialog', { name: 'Preferences' } )
).toMatchSnapshot();
} );
it( 'small viewports', async () => {
it( 'small viewports', () => {
useSelect.mockImplementation( () => [ true, true, false ] );
useViewportMatch.mockImplementation( () => false );
render( <EditPostPreferencesModal /> );
expect(
await screen.findByRole( 'dialog', { name: 'Preferences' } )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For small viewports, the modal uses the Navigator* components instead of TabPanel. The UI is completely synchronous, and the test doesn't need to await.

screen.getByRole( 'dialog', { name: 'Preferences' } )
).toMatchSnapshot();
} );
} );
Expand Down