From c64e6e3bf85b47685d13acb92abd7ac666897cbb Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Tue, 31 Jul 2018 12:59:41 +1000 Subject: [PATCH] Add a failing test for removing an empty first line. --- .../__snapshots__/splitting-merging.test.js.snap | 6 ++++++ test/e2e/specs/splitting-merging.test.js | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/test/e2e/specs/__snapshots__/splitting-merging.test.js.snap b/test/e2e/specs/__snapshots__/splitting-merging.test.js.snap index 50a37b4103e23..7896e30b1833b 100644 --- a/test/e2e/specs/__snapshots__/splitting-merging.test.js.snap +++ b/test/e2e/specs/__snapshots__/splitting-merging.test.js.snap @@ -1,5 +1,11 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`splitting and merging blocks Should delete an empty first line 1`] = ` +" +

+" +`; + exports[`splitting and merging blocks Should delete wholly-selected block contents 1`] = ` "

Foo

diff --git a/test/e2e/specs/splitting-merging.test.js b/test/e2e/specs/splitting-merging.test.js index 2c33f08c563ef..59ad34254aad4 100644 --- a/test/e2e/specs/splitting-merging.test.js +++ b/test/e2e/specs/splitting-merging.test.js @@ -89,4 +89,19 @@ describe( 'splitting and merging blocks', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); } ); + + it( 'Should delete an empty first line', async () => { + // Regression Test: When a paragraph block has line break, and the first + // line has no text, pressing backspace at the start of the second line + // should remove the first. + await insertBlock( 'Paragraph' ); + await page.keyboard.down( 'Shift' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.up( 'Shift' ); + + // Delete he soft line break. + await page.keyboard.press( 'Backspace' ); + + expect( await getEditedPostContent() ).toMatchSnapshot(); + } ); } );