Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi select: add e2e test for gruadual select all #32304

Merged
merged 1 commit into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
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();
} );
} );