From 8dcd64962b07034860e8c2b89d2dc33ed08f3211 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= <4710635+ellatrix@users.noreply.github.com> Date: Fri, 28 May 2021 15:12:07 +0300 Subject: [PATCH] Multi select: add e2e test for gruadual select all (#32304) --- .../multi-block-selection.test.js.snap | 24 +++++++++++ .../various/multi-block-selection.test.js | 42 ++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap index 5d4499423f1eb0..3964a7ccae7609 100644 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +++ b/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap @@ -70,6 +70,30 @@ exports[`Multi-block selection should cut and paste 2`] = ` " `; +exports[`Multi-block selection should gradually multi-select 1`] = ` +" +
+
+

1

+ + + +

2

+
+ + + +
+
+" +`; + +exports[`Multi-block selection should gradually multi-select 2`] = ` +" +
+" +`; + exports[`Multi-block selection should not multi select single block 1`] = ` "

diff --git a/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js b/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js index eba80dd658a89b..af70fa0b93b211 100644 --- a/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js +++ b/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js @@ -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' ); @@ -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(); + } ); } );