From d34c086ca3667eaf651a77c962fcf4168143e429 Mon Sep 17 00:00:00 2001 From: Jorge Date: Mon, 8 Oct 2018 16:16:12 +0100 Subject: [PATCH] Used empty string instead of null, as no alignment option. --- packages/editor/src/hooks/align.js | 2 +- test/e2e/specs/__snapshots__/align-hook.test.js.snap | 2 +- test/e2e/specs/align-hook.test.js | 3 +-- test/e2e/test-plugins/align-hook/index.js | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/editor/src/hooks/align.js b/packages/editor/src/hooks/align.js index cdd21af8b6764..7b80924c433e2 100644 --- a/packages/editor/src/hooks/align.js +++ b/packages/editor/src/hooks/align.js @@ -82,7 +82,7 @@ export const withToolbarControls = createHigherOrderComponent( ( BlockEdit ) => const blockType = getBlockType( props.name ); const blockDefaultAlign = get( blockType, [ 'attributes', 'align', 'default' ] ); if ( blockDefaultAlign ) { - nextAlign = null; + nextAlign = ''; } } props.setAttributes( { align: nextAlign } ); diff --git a/test/e2e/specs/__snapshots__/align-hook.test.js.snap b/test/e2e/specs/__snapshots__/align-hook.test.js.snap index e71583d682d62..e0075595e01b0 100644 --- a/test/e2e/specs/__snapshots__/align-hook.test.js.snap +++ b/test/e2e/specs/__snapshots__/align-hook.test.js.snap @@ -31,7 +31,7 @@ exports[`Align Hook Works As Expected Block with default align Correctly applies `; exports[`Align Hook Works As Expected Block with default align Correctly applies the selected alignment and correctly removes the alignment 2`] = ` -" +"
Test Align Hook
" `; diff --git a/test/e2e/specs/align-hook.test.js b/test/e2e/specs/align-hook.test.js index ff82df11765e4..02d28b131b749 100644 --- a/test/e2e/specs/align-hook.test.js +++ b/test/e2e/specs/align-hook.test.js @@ -191,8 +191,7 @@ describe( 'Align Hook Works As Expected', () => { // remove the alignment. await page.click( PRESSED_BUTTON_SELECTOR ); const markup = await getEditedPostContent(); - expect( markup ).toContain( '"align":null' ); - expect( markup ).not.toContain( 'alignnull' ); + expect( markup ).toContain( '"align":""' ); } ); createCorrectlyAppliesAndRemovesAlignmentTest( BLOCK_NAME, 'center' ); diff --git a/test/e2e/test-plugins/align-hook/index.js b/test/e2e/test-plugins/align-hook/index.js index 516dc1aac366d..927c491e84371 100644 --- a/test/e2e/test-plugins/align-hook/index.js +++ b/test/e2e/test-plugins/align-hook/index.js @@ -69,7 +69,7 @@ title: 'Test Default Align', attributes: { align: { - type: [ 'string', 'null' ], + type: 'string', default: 'right', }, },