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 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
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.press( incrementButton );
guarani marked this conversation as resolved.
Show resolved Hide resolved

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 @@ -37,6 +37,7 @@ function Stepper( {
return (
<View style={ styles.container }>
<TouchableOpacity
testID={ 'Increment' }
guarani marked this conversation as resolved.
Show resolved Hide resolved
disabled={ isMinValue }
onPressIn={ onPressInDecrement }
onPressOut={ onPressOut }
Expand Down