Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tests
  • Loading branch information
ntsekouras committed Apr 13, 2022
commit 0d20c2963e4a38c9d0398565e90a010fb5476556

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,7 @@
*/
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' );

test.describe( 'Copy/cut/paste of whole blocks', () => {
test( 'should copy and paste individual blocks', async ( {
page,
pageUtils,
} ) => {
await pageUtils.createNewPost();

await page.click( 'role=button[name="Add default block"i]' );

await page.keyboard.type(
'Here is a unique string so we can test copying.'
);
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '2' );
await page.keyboard.press( 'ArrowUp' );

await pageUtils.pressKeyWithModifier( 'primary', 'c' );
expect( await pageUtils.getEditedPostContent() ).toMatchSnapshot();

await page.keyboard.press( 'ArrowDown' );
await pageUtils.pressKeyWithModifier( 'primary', 'v' );
expect( await pageUtils.getEditedPostContent() ).toMatchSnapshot();
} );

test.describe( 'Copy/cut/paste', () => {
test( 'should copy blocks when non textual elements are focused (image, spacer)', async ( {
page,
pageUtils,
Expand All @@ -47,24 +24,22 @@ test.describe( 'Copy/cut/paste of whole blocks', () => {
expect( await pageUtils.getEditedPostContent() ).toMatchSnapshot();
} );

test( 'should cut and paste individual blocks', async ( {
test( 'should cut and paste individual non textual blocks', async ( {
page,
pageUtils,
} ) => {
await pageUtils.createNewPost();

await page.click( 'role=button[name="Add default block"i]' );

await page.keyboard.type( 'Yet another unique string.' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '2' );
await page.keyboard.press( 'ArrowUp' );

await pageUtils.insertBlock( { name: 'core/spacer' } );
// At this point the spacer wrapper should be focused.
await pageUtils.pressKeyWithModifier( 'primary', 'x' );
expect( await pageUtils.getEditedPostContent() ).toMatchSnapshot();

await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'ArrowDown' );
// The block appender is only visible when there's no selection.
await page.evaluate( () => {
window.wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock();
} );
await page.click( 'role=button[name="Add default block"i]' );
await pageUtils.pressKeyWithModifier( 'primary', 'v' );
expect( await pageUtils.getEditedPostContent() ).toMatchSnapshot();
} );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:spacer -->
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->