Skip to content

Commit

Permalink
Improve a few more queries
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Dec 23, 2022
1 parent ab548b0 commit a0692b1
Showing 1 changed file with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe( 'ImageSizeControl', () => {
expect( heightInput ).toHaveValue( 300 );
expect( widthInput ).toHaveValue( 400 );

await user.click( screen.getByText( 'Reset' ) );
await user.click( screen.getByRole( 'button', { name: 'Reset' } ) );

// Both attributes are set to undefined to clear custom values.
expect( mockOnChange ).toHaveBeenLastCalledWith( {
Expand All @@ -272,9 +272,14 @@ describe( 'ImageSizeControl', () => {
/>
);

await user.click( screen.getByText( '50%' ) );
const button = screen.getByRole( 'button', {
name: '50%',
pressed: false,
} );

await user.click( button );

expect( screen.getByText( '50%' ) ).toHaveClass( 'is-pressed' );
expect( button ).toHaveClass( 'is-pressed' );

// Both attributes are set to the rounded scaled value.
expect( mockOnChange ).toHaveBeenLastCalledWith( {
Expand All @@ -294,7 +299,12 @@ describe( 'ImageSizeControl', () => {
/>
);

await user.click( screen.getByText( '50%' ) );
const button = screen.getByRole( 'button', {
name: '50%',
pressed: false,
} );

await user.click( button );

// Both attributes are set to the rounded scaled value.
expect(
Expand Down Expand Up @@ -323,9 +333,9 @@ describe( 'ImageSizeControl', () => {
/>
);

expect( screen.getByLabelText( 'Image size' ) ).toHaveValue(
'medium'
);
expect(
screen.getByRole( 'combobox', { name: 'Image size' } )
).toHaveValue( 'medium' );
} );

it( 'calls onChangeImage with selected slug on selection', async () => {
Expand All @@ -341,7 +351,7 @@ describe( 'ImageSizeControl', () => {
);

await user.selectOptions(
screen.getByLabelText( 'Image size' ),
screen.getByRole( 'combobox', { name: 'Image size' } ),
'thumbnail'
);

Expand Down

1 comment on commit a0692b1

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3766015978
📝 Reported issues:

Please sign in to comment.