Skip to content

Commit

Permalink
Fix indexes, merge style button queries into one
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnajdr committed Dec 19, 2022
1 parent 0b7fbd5 commit 327ad40
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions packages/components/src/border-box-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,20 +201,12 @@ describe( 'BorderBoxControl', () => {
);

const styleLabel = screen.queryByText( 'Style' );
const solidButton = screen.queryByRole( 'button', {
name: 'Solid',
} );
const dashedButton = screen.queryByRole( 'button', {
name: 'Dashed',
} );
const dottedButton = screen.queryByRole( 'button', {
name: 'Dotted',
const styleButtons = screen.queryAllByRole( 'button', {
name: /(Solid)|(Dashed)|(Dotted)/,
} );

expect( styleLabel ).not.toBeInTheDocument();
expect( solidButton ).not.toBeInTheDocument();
expect( dashedButton ).not.toBeInTheDocument();
expect( dottedButton ).not.toBeInTheDocument();
expect( styleButtons.length ).toBe( 0 );
} );
} );

Expand Down Expand Up @@ -292,7 +284,7 @@ describe( 'BorderBoxControl', () => {

for ( let i = 0; i < colorButtons.length; i++ ) {
// Click on the color button to show the color picker popover.
await user.click( colorButtons[ 0 ] );
await user.click( colorButtons[ i ] );

// Wait for color picker popover to fully appear
const colorPickerButton = screen.getByRole( 'button', {
Expand All @@ -305,23 +297,15 @@ describe( 'BorderBoxControl', () => {
);

const styleLabel = screen.queryByText( 'Style' );
const solidButton = screen.queryByRole( 'button', {
name: 'Solid',
} );
const dashedButton = screen.queryByRole( 'button', {
name: 'Dashed',
} );
const dottedButton = screen.queryByRole( 'button', {
name: 'Dotted',
const styleButtons = screen.queryAllByRole( 'button', {
name: /(Solid)|(Dashed)|(Dotted)/,
} );

expect( styleLabel ).not.toBeInTheDocument();
expect( solidButton ).not.toBeInTheDocument();
expect( dashedButton ).not.toBeInTheDocument();
expect( dottedButton ).not.toBeInTheDocument();
expect( styleButtons.length ).toBe( 0 );

// Click again to hide the popover.
await user.click( colorButtons[ 0 ] );
await user.click( colorButtons[ i ] );
}
} );
} );
Expand Down

1 comment on commit 327ad40

@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/3731660695
📝 Reported issues:

Please sign in to comment.