Skip to content

Commit

Permalink
Multi select: add e2e test for gruadual select all (#32304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored May 28, 2021
1 parent 12a6e4b commit 8dcd649
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,30 @@ exports[`Multi-block selection should cut and paste 2`] = `
<!-- /wp:paragraph -->"
`;

exports[`Multi-block selection should gradually multi-select 1`] = `
"<!-- wp:columns -->
<div class=\\"wp-block-columns\\"><!-- wp:column -->
<div class=\\"wp-block-column\\"><!-- wp:paragraph -->
<p>1</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>2</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class=\\"wp-block-column\\"></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->"
`;
exports[`Multi-block selection should gradually multi-select 2`] = `
"<!-- wp:columns -->
<div class=\\"wp-block-columns\\"></div>
<!-- /wp:columns -->"
`;
exports[`Multi-block selection should not multi select single block 1`] = `
"<!-- wp:paragraph -->
<p></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ describe( 'Multi-block selection', () => {
expect( await getEditedPostContent() ).toMatchSnapshot();
} );

// Previously we would unexpectedly duplicated the block on Enter.
// Previously we would unexpectedly duplicate the block on Enter.
it( 'should not multi select single block', async () => {
await clickBlockAppender();
await page.keyboard.type( '1' );
Expand All @@ -601,4 +601,44 @@ describe( 'Multi-block selection', () => {

expect( await getEditedPostContent() ).toMatchSnapshot();
} );

it( 'should gradually multi-select', async () => {
await clickBlockAppender();
await page.keyboard.type( '/columns' );
await page.keyboard.press( 'Enter' );
// Select two columns.
await page.keyboard.press( 'ArrowRight' );
await page.keyboard.press( 'ArrowRight' );
await page.keyboard.press( 'Enter' );
// Navigate to appender.
await page.keyboard.press( 'ArrowRight' );
await page.keyboard.press( 'Enter' );
// Select a paragraph.
await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '1' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '2' );

// Confirm correct setup: two columns with two paragraphs in the first.
expect( await getEditedPostContent() ).toMatchSnapshot();

await pressKeyWithModifier( 'primary', 'a' );
await pressKeyWithModifier( 'primary', 'a' );

await page.waitForSelector(
'[data-type="core/paragraph"].is-multi-selected'
);

await pressKeyWithModifier( 'primary', 'a' );

await page.waitForSelector(
'[data-type="core/column"].is-multi-selected'
);

await page.keyboard.press( 'Backspace' );

// Expect both columns to be deleted.
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
} );

0 comments on commit 8dcd649

Please sign in to comment.