From ee280e131c35037a05d07adfeac4234475736233 Mon Sep 17 00:00:00 2001 From: Paul Von Schrottky Date: Mon, 19 Jul 2021 16:59:37 -0400 Subject: [PATCH 1/3] Update button block corner radius test to px --- .../src/buttons/test/edit.native.js | 22 ++++++++++++------- .../stepper-cell/stepper.android.js | 1 + 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/block-library/src/buttons/test/edit.native.js b/packages/block-library/src/buttons/test/edit.native.js index e3038ea02588fd..1cdb39558f524f 100644 --- a/packages/block-library/src/buttons/test/edit.native.js +++ b/packages/block-library/src/buttons/test/edit.native.js @@ -30,11 +30,11 @@ afterAll( () => { describe( 'when a button is shown', () => { it( 'adjusts the border radius', async () => { const initialHtml = ` -
- +
+
`; - const { getByA11yLabel, getByTestId } = await initializeEditor( { + const { getByA11yLabel } = await initializeEditor( { initialHtml, } ); @@ -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 ); + + await waitFor( () => getByA11yLabel( /Border Radius/ ) ); const expectedHtml = ` -
- + `; expect( getEditorHtml() ).toBe( expectedHtml ); diff --git a/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js b/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js index efa69f3892326f..e845c36711f2df 100644 --- a/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +++ b/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js @@ -37,6 +37,7 @@ function Stepper( { return ( Date: Thu, 22 Jul 2021 12:09:18 -0400 Subject: [PATCH 2/3] Incorporate PR feedback to make tests pass --- packages/block-library/src/buttons/test/edit.native.js | 2 +- .../src/mobile/bottom-sheet/stepper-cell/stepper.android.js | 2 +- .../src/mobile/bottom-sheet/stepper-cell/stepper.ios.js | 1 + test/native/__mocks__/styleMock.js | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/buttons/test/edit.native.js b/packages/block-library/src/buttons/test/edit.native.js index 1cdb39558f524f..263030f0e9f473 100644 --- a/packages/block-library/src/buttons/test/edit.native.js +++ b/packages/block-library/src/buttons/test/edit.native.js @@ -73,7 +73,7 @@ describe( 'when a button is shown', () => { const incrementButton = await waitFor( () => within( radiusStepper ).getByTestId( 'Increment' ) ); - fireEvent.press( incrementButton ); + fireEvent( incrementButton, 'onPressIn' ); await waitFor( () => getByA11yLabel( /Border Radius/ ) ); diff --git a/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js b/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js index e845c36711f2df..37f72425640fe0 100644 --- a/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js +++ b/packages/components/src/mobile/bottom-sheet/stepper-cell/stepper.android.js @@ -37,7 +37,6 @@ function Stepper( { return ( Date: Fri, 23 Jul 2021 09:57:24 -0400 Subject: [PATCH 3/3] Remove unnecessary step from buttons test --- packages/block-library/src/buttons/test/edit.native.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/block-library/src/buttons/test/edit.native.js b/packages/block-library/src/buttons/test/edit.native.js index 263030f0e9f473..cfee24e237fcfd 100644 --- a/packages/block-library/src/buttons/test/edit.native.js +++ b/packages/block-library/src/buttons/test/edit.native.js @@ -75,8 +75,6 @@ describe( 'when a button is shown', () => { ); fireEvent( incrementButton, 'onPressIn' ); - await waitFor( () => getByA11yLabel( /Border Radius/ ) ); - const expectedHtml = `