Skip to content

Commit

Permalink
Testing: Add E2E case to ensure cleaned TinyMCE content
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jul 20, 2018
1 parent f2f8bd5 commit 1a637ee
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/e2e/specs/__snapshots__/writing-flow.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ exports[`adding blocks Should navigate inner blocks with arrow keys 1`] = `
<!-- /wp:paragraph -->"
`;
exports[`adding blocks should clean TinyMCE content 1`] = `
"<!-- wp:paragraph -->
<p><strong></strong></p>
<!-- /wp:paragraph -->"
`;
exports[`adding blocks should clean TinyMCE content 2`] = `
"<!-- wp:paragraph -->
<p><strong>Inside</strong></p>
<!-- /wp:paragraph -->"
`;
exports[`adding blocks should navigate around inline boundaries 1`] = `
"<!-- wp:paragraph -->
<p>FirstAfter</p>
Expand Down
18 changes: 18 additions & 0 deletions test/e2e/specs/writing-flow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,22 @@ describe( 'adding blocks', () => {

expect( await getEditedPostContent() ).toMatchSnapshot();
} );

it( 'should clean TinyMCE content', async () => {
// Ensure no zero-width space character. Notably, this can occur when
// save occurs while at an inline boundary edge.
await page.click( '.editor-default-block-appender__content' );
await pressWithModifier( 'mod', 'b' );
expect( await getEditedPostContent() ).toMatchSnapshot();

// When returning to Visual mode, backspace in selected block should
// reset to the provisional block.
await page.keyboard.press( 'Backspace' );

// Ensure no data-mce-selected. Notably, this can occur when content
// is saved while typing within an inline boundary.
await pressWithModifier( 'mod', 'b' );
await page.keyboard.type( 'Inside' );
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
} );

0 comments on commit 1a637ee

Please sign in to comment.