Skip to content

Commit

Permalink
Test for rapid enter presses (#11665)
Browse files Browse the repository at this point in the history
  • Loading branch information
notnownikki committed Nov 9, 2018
1 parent 665ac6d commit 66fc483
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test/e2e/specs/writing-flow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,30 @@ describe( 'adding blocks', () => {
it( 'should not delete trailing spaces when deleting a word with alt + backspace', async () => {
await clickBlockAppender();
await page.keyboard.type( 'alpha beta gamma delta' );
await pressWithModifier( META_KEY, 'Backspace' );
if ( process.platform === 'darwin' ) {
await pressWithModifier( 'Alt', 'Backspace' );
} else {
await pressWithModifier( META_KEY, 'Backspace' );
}
await page.keyboard.type( 'delta' );
const blockText = await page.evaluate( () => document.activeElement.textContent );
expect( blockText ).toBe( 'alpha beta gamma delta' );
} );

it( 'should create valid paragraph blocks when rapidly pressing Enter', async () => {
await clickBlockAppender();
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
await page.keyboard.press( 'Enter' );
// Check that none of the paragraph blocks have <br> in them.
const postContent = await getEditedPostContent();
expect( postContent.indexOf( 'br' ) ).toBe( -1 );
} );
} );

0 comments on commit 66fc483

Please sign in to comment.