Skip to content

Commit

Permalink
Fix save lock control (length check on object) (#11636)
Browse files Browse the repository at this point in the history
* Fix length check on object

* Editor: Correct state shape of tested post saving lock
  • Loading branch information
glingener authored and aduth committed Nov 8, 2018
1 parent a0d0e1a commit 4369d93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ export function isPostLocked( state ) {
* @return {boolean} Is locked.
*/
export function isPostSavingLocked( state ) {
return state.postSavingLock.length > 0;
return Object.keys( state.postSavingLock ).length > 0;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/editor/src/store/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ describe( 'selectors', () => {
describe( 'isPostSavingLocked', () => {
it( 'should return true if the post has postSavingLocks', () => {
const state = {
postSavingLock: [ { 1: true } ],
postSavingLock: { example: true },
currentPost: {},
saving: {},
};
Expand All @@ -1108,7 +1108,7 @@ describe( 'selectors', () => {

it( 'should return false if the post has no postSavingLocks', () => {
const state = {
postSavingLock: [],
postSavingLock: {},
currentPost: {},
saving: {},
};
Expand Down

0 comments on commit 4369d93

Please sign in to comment.