Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update BorderBoxControl tests to match latest aria labels
  • Loading branch information
aaronrobertshaw committed Mar 24, 2022
commit 804ec2ad1a556345d43ce0acf385af092b64cad7
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