diff --git a/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap b/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap index bf5fefd31a7e32..af5c955551fa8b 100644 --- a/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap +++ b/packages/e2e-tests/specs/__snapshots__/rich-text.test.js.snap @@ -42,6 +42,10 @@ exports[`RichText should not lose selection direction 1`] = ` " `; +exports[`RichText should not undo backtick transform with backspace after selection change 1`] = `""`; + +exports[`RichText should not undo backtick transform with backspace after typing 1`] = `""`; + exports[`RichText should only mutate text data on input 1`] = ` "
1234
@@ -65,3 +69,9 @@ exports[`RichText should transform backtick to code 2`] = `A \`backtick\`
" `; + +exports[`RichText should undo backtick transform with backspace 1`] = ` +" +\`a\`
+" +`; diff --git a/packages/e2e-tests/specs/blocks/__snapshots__/list.test.js.snap b/packages/e2e-tests/specs/blocks/__snapshots__/list.test.js.snap index a7212afc153e6f..3977074c2e329f 100644 --- a/packages/e2e-tests/specs/blocks/__snapshots__/list.test.js.snap +++ b/packages/e2e-tests/specs/blocks/__snapshots__/list.test.js.snap @@ -200,6 +200,8 @@ exports[`List should not transform lines in block when transforming multiple blo " `; +exports[`List should not undo asterisk transform with backspace after typing 1`] = `""`; + exports[`List should outdent with children 1`] = ` "*
+" +`; diff --git a/packages/e2e-tests/specs/blocks/list.test.js b/packages/e2e-tests/specs/blocks/list.test.js index 776483ae4eb6a2..44561a3b30cd1b 100644 --- a/packages/e2e-tests/specs/blocks/list.test.js +++ b/packages/e2e-tests/specs/blocks/list.test.js @@ -55,6 +55,23 @@ describe( 'List', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); } ); + it( 'should undo asterisk transform with backspace', async () => { + await clickBlockAppender(); + await page.keyboard.type( '* ' ); + await page.keyboard.press( 'Backspace' ); + + expect( await getEditedPostContent() ).toMatchSnapshot(); + } ); + + it( 'should not undo asterisk transform with backspace after typing', async () => { + await clickBlockAppender(); + await page.keyboard.type( '* a' ); + await page.keyboard.press( 'Backspace' ); + await page.keyboard.press( 'Backspace' ); + + expect( await getEditedPostContent() ).toMatchSnapshot(); + } ); + it( 'can be created by typing "/list"', async () => { // Create a list with the slash block shortcut. await clickBlockAppender(); diff --git a/packages/e2e-tests/specs/rich-text.test.js b/packages/e2e-tests/specs/rich-text.test.js index dcb1434abd89be..f8a60c131312f2 100644 --- a/packages/e2e-tests/specs/rich-text.test.js +++ b/packages/e2e-tests/specs/rich-text.test.js @@ -110,6 +110,35 @@ describe( 'RichText', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); } ); + it( 'should undo backtick transform with backspace', async () => { + await clickBlockAppender(); + await page.keyboard.type( '`a`' ); + await page.keyboard.press( 'Backspace' ); + + expect( await getEditedPostContent() ).toMatchSnapshot(); + } ); + + it( 'should not undo backtick transform with backspace after typing', async () => { + await clickBlockAppender(); + await page.keyboard.type( '`a`b' ); + await page.keyboard.press( 'Backspace' ); + await page.keyboard.press( 'Backspace' ); + + expect( await getEditedPostContent() ).toMatchSnapshot(); + } ); + + it( 'should not undo backtick transform with backspace after selection change', async () => { + await clickBlockAppender(); + await page.keyboard.type( '`a`' ); + // Move inside format boundary. + await page.keyboard.press( 'ArrowLeft' ); + await page.keyboard.press( 'ArrowLeft' ); + await page.keyboard.press( 'ArrowRight' ); + await page.keyboard.press( 'Backspace' ); + + expect( await getEditedPostContent() ).toMatchSnapshot(); + } ); + it( 'should not format text after code backtick', async () => { await clickBlockAppender(); await page.keyboard.type( 'A `backtick` and more.' );