Skip to content

Commit

Permalink
Revert "Fix insertion point displaying when there are no inserter ite…
Browse files Browse the repository at this point in the history
…ms (#32576)"

This reverts commit 80ab980.
  • Loading branch information
talldan committed Jul 2, 2021
1 parent e129ab7 commit f2c2342
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
12 changes: 1 addition & 11 deletions packages/block-editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,17 +1215,7 @@ export function getBlockInsertionPoint( state ) {
* @return {?boolean} Whether the insertion point is visible or not.
*/
export function isBlockInsertionPointVisible( state ) {
const insertionPoint = state.insertionPoint;

if ( ! state.insertionPoint ) {
return false;
}

if ( getTemplateLock( state, insertionPoint.rootClientId ) ) {
return false;
}

return true;
return state.insertionPoint !== null;
}

/**
Expand Down
31 changes: 0 additions & 31 deletions packages/block-editor/src/store/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2255,43 +2255,12 @@ describe( 'selectors', () => {
expect( isBlockInsertionPointVisible( state ) ).toBe( false );
} );

it( 'should return false if the rootClientId has a truthy template lock', () => {
const state = {
insertionPoint: {
rootClientId: 'testClientId',
index: 5,
},
blockListSettings: {
testClientId: {
templateLock: 'all',
},
},
};

expect( isBlockInsertionPointVisible( state ) ).toBe( false );
} );

it( 'should return false if the rootClientId is undefined, and the settings has a template lock', () => {
const state = {
insertionPoint: {
rootClientId: undefined,
index: 5,
},
settings: {
templateLock: 'all',
},
};

expect( isBlockInsertionPointVisible( state ) ).toBe( false );
} );

it( 'should return true if assigned insertion point', () => {
const state = {
insertionPoint: {
rootClientId: undefined,
index: 5,
},
settings: {},
};

expect( isBlockInsertionPointVisible( state ) ).toBe( true );
Expand Down

0 comments on commit f2c2342

Please sign in to comment.