diff --git a/packages/editor/src/components/post-publish-button/index.js b/packages/editor/src/components/post-publish-button/index.js index cfed6dbd112f53..18eba3606e7118 100644 --- a/packages/editor/src/components/post-publish-button/index.js +++ b/packages/editor/src/components/post-publish-button/index.js @@ -73,6 +73,9 @@ export class PostPublishButton extends Component { } const onClick = () => { + if ( isButtonDisabled ) { + return; + } onSubmit(); onStatusChange( publishStatus ); onSave(); diff --git a/packages/editor/src/components/post-publish-button/test/index.js b/packages/editor/src/components/post-publish-button/test/index.js index 8fbef6007144a0..30156438cc14f1 100644 --- a/packages/editor/src/components/post-publish-button/test/index.js +++ b/packages/editor/src/components/post-publish-button/test/index.js @@ -103,7 +103,10 @@ describe( 'PostPublishButton', () => { + onSave={ onSave } + isSaveable={ true } + isPublishable={ true } + /> ); wrapper.simulate( 'click' ); @@ -119,7 +122,9 @@ describe( 'PostPublishButton', () => { hasPublishAction={ true } onStatusChange={ onStatusChange } onSave={ onSave } - isBeingScheduled /> + isBeingScheduled + isSaveable={ true } + isPublishable={ true } /> ); wrapper.simulate( 'click' ); @@ -135,7 +140,9 @@ describe( 'PostPublishButton', () => { hasPublishAction={ true } onStatusChange={ onStatusChange } onSave={ onSave } - visibility="private" /> + visibility="private" + isSaveable={ true } + isPublishable={ true } /> ); wrapper.simulate( 'click' ); @@ -150,7 +157,9 @@ describe( 'PostPublishButton', () => { + onSave={ onSave } + isSaveable={ true } + isPublishable={ true } /> ); wrapper.simulate( 'click' ); @@ -167,7 +176,9 @@ describe( 'PostPublishButton', () => { + onSave={ onSave } + isSaveable={ true } + isPublishable={ true } /> ); wrapper.simulate( 'click' );