Skip to content

Commit

Permalink
Fix: Notice blocks don't match template doesn't appear; Add test case; (
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta authored and youknowriad committed May 29, 2019
1 parent 50652ea commit 88e464f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/e2e-tests/specs/plugins/cpt-locking.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
deactivatePlugin,
getEditedPostContent,
insertBlock,
setPostContent,
} from '@wordpress/e2e-test-utils';

describe( 'cpt locking', () => {
Expand Down Expand Up @@ -58,6 +59,20 @@ describe( 'cpt locking', () => {
await page.$( 'button[aria-label="Move up"]' )
).toBeNull();
} );

it( 'should show invalid template notice if the blocks do not match the templte', async () => {
const content = await getEditedPostContent();
const [ , contentWithoutImage ] = content.split( '<!-- /wp:image -->' );
await setPostContent( contentWithoutImage );
const VALIDATION_PARAGRAPH_SELECTOR = '.editor-template-validation-notice .components-notice__content p';
await page.waitForSelector( VALIDATION_PARAGRAPH_SELECTOR );
expect(
await page.evaluate(
( element ) => element.textContent,
await page.$( VALIDATION_PARAGRAPH_SELECTOR )
)
).toEqual( 'The content of your post doesn’t match the template assigned to your post type.' );
} );
} );

describe( 'template_lock insert', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class EditorProvider extends Component {
'isRTL',
'maxWidth',
'styles',
'template',
'templateLock',
'titlePlaceholder',
] ),
Expand Down

0 comments on commit 88e464f

Please sign in to comment.