Skip to content
Merged
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
41 changes: 41 additions & 0 deletions test/e2e/specs/editor/various/multi-block-selection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading