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

Update button block corner radius test to px #33562

Merged
merged 3 commits into from
Jul 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
22 changes: 14 additions & 8 deletions packages/block-library/src/buttons/test/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ afterAll( () => {
describe( 'when a button is shown', () => {
it( 'adjusts the border radius', async () => {
const initialHtml = `<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"style":{"border":{"radius":"5%"}}} -->
<div class="wp-block-button"><a class="wp-block-button__link" style="border-radius:5%" >Hello</a></div>
<div class="wp-block-buttons"><!-- wp:button {"style":{"border":{"radius":"5px"}}} -->
<div class="wp-block-button"><a class="wp-block-button__link" style="border-radius:5px" >Hello</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->`;
const { getByA11yLabel, getByTestId } = await initializeEditor( {
const { getByA11yLabel } = await initializeEditor( {
initialHtml,
} );

Expand Down Expand Up @@ -66,14 +66,20 @@ describe( 'when a button is shown', () => {
);
fireEvent.press( settingsButton );

const radiusSlider = await waitFor( () =>
getByTestId( 'Slider Border Radius' )
const radiusStepper = await waitFor( () =>
getByA11yLabel( /Border Radius/ )
);
fireEvent( radiusSlider, 'valueChange', '25' );

const incrementButton = await waitFor( () =>
within( radiusStepper ).getByTestId( 'Increment' )
);
fireEvent( incrementButton, 'onPressIn' );

await waitFor( () => getByA11yLabel( /Border Radius/ ) );
guarani marked this conversation as resolved.
Show resolved Hide resolved

const expectedHtml = `<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"style":{"border":{"radius":"25%"}}} -->
<div class="wp-block-button"><a class="wp-block-button__link" href="" style="border-radius:25%">Hello</a></div>
<div class="wp-block-buttons"><!-- wp:button {"style":{"border":{"radius":"6px"}}} -->
<div class="wp-block-button"><a class="wp-block-button__link" href="" style="border-radius:6px">Hello</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->`;
expect( getEditorHtml() ).toBe( expectedHtml );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function Stepper( {
) }
{ children }
<TouchableOpacity
testID={ 'Increment' }
disabled={ isMaxValue }
onPressIn={ onPressInIncrement }
onPressOut={ onPressOut }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function Stepper( {
<Icon icon={ minus } size={ 24 } color={ buttonStyle.color } />
</TouchableOpacity>
<TouchableOpacity
testID={ 'Increment' }
disabled={ isMaxValue }
onPressIn={ onPressInIncrement }
onPressOut={ onPressOut }
Expand Down
3 changes: 3 additions & 0 deletions test/native/__mocks__/styleMock.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ module.exports = {
arrow: {
color: 'red',
},
button: {
color: 'red',
},
textInput: {
color: 'black',
},
Expand Down