From 6d71b6d7d1da22b13f4602bd6bcc20a7d7cd3bd1 Mon Sep 17 00:00:00 2001 From: ella Date: Tue, 30 Jun 2026 09:41:15 -0700 Subject: [PATCH] Add an e2e test for single paragraph selection on triple click Triple clicking a paragraph should select only that paragraph, not collapse the caret or extend the selection into the next block. This behavior shipped without a test; add one to lock it in. Co-Authored-By: Claude Opus 4.8 --- .../various/multi-block-selection.spec.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/test/e2e/specs/editor/various/multi-block-selection.spec.js b/test/e2e/specs/editor/various/multi-block-selection.spec.js index c26853bea16cf0..afdae924d379f3 100644 --- a/test/e2e/specs/editor/various/multi-block-selection.spec.js +++ b/test/e2e/specs/editor/various/multi-block-selection.spec.js @@ -835,6 +835,47 @@ test.describe( 'Multi-block selection (@firefox, @webkit)', () => { ] ); } ); + test( 'should select a single paragraph on triple click', async ( { + page, + editor, + multiBlockSelectionUtils, + } ) => { + await editor.insertBlock( { + name: 'core/paragraph', + attributes: { content: 'One two three' }, + } ); + await editor.insertBlock( { + name: 'core/paragraph', + attributes: { content: 'Second' }, + } ); + + // Move the caret into the first paragraph so its block toolbar + // repositions above it and stops overlapping the text. + await page.keyboard.press( 'ArrowUp' ); + + // Triple click selects the paragraph. The browser extends the forward + // selection into the next block at offset 0; that overshoot must not + // collapse the selection or extend it into the next block. + await editor.canvas + .getByRole( 'document', { name: 'Block: Paragraph' } ) + .first() + .click( { clickCount: 3 } ); + + // Only the first paragraph is selected, not a multi-block selection + // reaching into the second. + await expect + .poll( multiBlockSelectionUtils.getSelectedBlocks ) + .toMatchObject( [ { name: 'core/paragraph' } ] ); + + // The whole paragraph is selected (not collapsed), so typing replaces + // its content. + await page.keyboard.type( 'a' ); + await expect.poll( editor.getBlocks ).toMatchObject( [ + { name: 'core/paragraph', attributes: { content: 'a' } }, + { name: 'core/paragraph', attributes: { content: 'Second' } }, + ] ); + } ); + test( 'should gradually multi-select', async ( { page, editor,