Skip to content

Commit

Permalink
Column Block: enable global template_lock inheritance (#42677)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano authored Sep 6, 2022
1 parent 9082cf5 commit 2c8ae8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
7 changes: 1 addition & 6 deletions packages/block-library/src/column/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
import { sprintf, __ } from '@wordpress/i18n';

function ColumnEdit( {
attributes: {
verticalAlignment,
width,
templateLock = false,
allowedBlocks,
},
attributes: { verticalAlignment, width, templateLock, allowedBlocks },
setAttributes,
clientId,
} ) {
Expand Down
30 changes: 15 additions & 15 deletions packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,22 @@ describe( 'cpt locking', () => {
);
} );

it( 'can use the global inserter in inner blocks', async () => {
it( 'should not allow blocks to be inserted in inner blocks', async () => {
await page.click( 'button[aria-label="Two columns; equal split"]' );
await page.click(
'.wp-block-column .block-editor-button-block-appender'
);
await page.type( '.block-editor-inserter__search input', 'image' );
await pressKeyTimes( 'Tab', 2 );
await page.keyboard.press( 'Enter' );
await page.click( '.edit-post-header-toolbar__inserter-toggle' );
await page.type(
'.block-editor-inserter__search input',
'gallery'
);
await pressKeyTimes( 'Tab', 2 );
await page.keyboard.press( 'Enter' );
expect( await page.$( '.wp-block-gallery' ) ).not.toBeNull();
expect(
await page.$(
'.wp-block-column .block-editor-button-block-appender'
)
).toBeNull();

expect(
await page.evaluate( () => {
const inserter = document.querySelector(
'.edit-post-header [aria-label="Add block"], .edit-post-header [aria-label="Toggle block inserter"]'
);
return inserter.getAttribute( 'disabled' );
} )
).not.toBeNull();
} );
} );

Expand Down

0 comments on commit 2c8ae8e

Please sign in to comment.