Skip to content

Commit

Permalink
Used empty string instead of null, as no alignment option.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Oct 8, 2018
1 parent ccb5cda commit d34c086
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/editor/src/hooks/align.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } );
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/__snapshots__/align-hook.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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`] = `
"<!-- wp:test/test-default-align {\\"align\\":null} -->
"<!-- wp:test/test-default-align {\\"align\\":\\"\\"} -->
<div style=\\"outline:1px solid gray;padding:5px\\" class=\\"wp-block-test-test-default-align\\">Test Align Hook</div>
<!-- /wp:test/test-default-align -->"
`;
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/specs/align-hook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/test-plugins/align-hook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
title: 'Test Default Align',
attributes: {
align: {
type: [ 'string', 'null' ],
type: 'string',
default: 'right',
},
},
Expand Down

0 comments on commit d34c086

Please sign in to comment.