Skip to content

Commit

Permalink
Add test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Apr 30, 2019
1 parent a478046 commit bdd1e0b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`cpt locking template_lock all should not error when deleting the cotents of a paragraph 1`] = `
"<!-- wp:image -->
<figure class=\\"wp-block-image\\"><img alt=\\"\\"/></figure>
<!-- /wp:image -->
<!-- wp:paragraph {\\"placeholder\\":\\"Add a description\\"} -->
<p></p>
<!-- /wp:paragraph -->
<!-- wp:quote -->
<blockquote class=\\"wp-block-quote\\"><p></p></blockquote>
<!-- /wp:quote -->"
`;
exports[`cpt locking template_lock false should allow blocks to be inserted 1`] = `
"<!-- wp:image -->
<figure class=\\"wp-block-image\\"><img alt=\\"\\"/></figure>
Expand Down
9 changes: 9 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,
pressKeyTimes,
} from '@wordpress/e2e-test-utils';

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

it( 'should not error when deleting the cotents of a paragraph', async () => {
await page.click( '.block-editor-block-list__block[data-type="core/paragraph"] p' );
const textToType = 'Paragraph';
await page.keyboard.type( 'Paragraph' );
await pressKeyTimes( 'Backspace', textToType.length + 1 );
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
} );

describe( 'template_lock insert', () => {
Expand Down

0 comments on commit bdd1e0b

Please sign in to comment.