Skip to content

Commit

Permalink
Update BorderBoxControl tests to match latest aria labels
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Mar 21, 2022
1 parent ed0becb commit 08acd46
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/components/src/border-box-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ const props = {
value: undefined,
};

const toggleLabelRegex = /Border color( and style)* picker/;
const colorPickerRegex = /Border color picker/;

const renderBorderBoxControl = ( customProps ) => {
return render( <BorderBoxControl { ...{ ...props, ...customProps } } /> );
};
Expand Down Expand Up @@ -75,7 +78,7 @@ describe( 'BorderBoxControl', () => {
renderBorderBoxControl();

const label = screen.getByText( props.label );
const colorButton = screen.getByLabelText( 'Open border options' );
const colorButton = screen.getByLabelText( toggleLabelRegex );
const widthInput = screen.getByRole( 'spinbutton' );
const unitSelect = screen.getByRole( 'combobox' );
const slider = screen.getByRole( 'slider' );
Expand Down Expand Up @@ -148,7 +151,7 @@ describe( 'BorderBoxControl', () => {
it( 'should omit style options when requested', () => {
renderBorderBoxControl( { enableStyle: false } );

const colorButton = screen.getByLabelText( 'Open border options' );
const colorButton = screen.getByLabelText( colorPickerRegex );
fireEvent.click( colorButton );

const styleLabel = screen.queryByText( 'Style' );
Expand All @@ -167,9 +170,7 @@ describe( 'BorderBoxControl', () => {
it( 'should render split view by default when mixed values provided', () => {
renderBorderBoxControl( { value: mixedBorders } );

const colorButtons = screen.getAllByLabelText(
'Open border options'
);
const colorButtons = screen.getAllByLabelText( toggleLabelRegex );
const widthInputs = screen.getAllByRole( 'spinbutton' );
const unitSelects = screen.getAllByRole( 'combobox' );
const sliders = screen.queryAllByRole( 'slider' );
Expand Down Expand Up @@ -208,9 +209,7 @@ describe( 'BorderBoxControl', () => {
renderBorderBoxControl( { enableStyle: false } );
clickButton( 'Unlink sides' );

const colorButtons = screen.getAllByLabelText(
'Open border options'
);
const colorButtons = screen.getAllByLabelText( colorPickerRegex );

colorButtons.forEach( ( button ) => {
fireEvent.click( button );
Expand Down

0 comments on commit 08acd46

Please sign in to comment.