Skip to content

Commit

Permalink
Add an e2e test for the autop issue
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Oct 25, 2018
1 parent 544c337 commit 60e22bf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Compatibility with Classic Editor Should not apply autop when rendering blocks 1`] = `
"
<a>
Random Link
</a>
"
`;
33 changes: 33 additions & 0 deletions test/e2e/specs/compatibility-classic-editor.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Internal dependencies
*/
import { newPost, insertBlock, publishPost } from '../support/utils';

describe( 'Compatibility with Classic Editor', () => {
beforeEach( async () => {
await newPost();
} );

it( 'Should not apply autop when rendering blocks', async () => {
// Save should not be an option for new empty post.
expect( await page.$( '.editor-post-save-draft' ) ).toBe( null );

// Add title to enable valid non-empty post save.
await insertBlock( 'Custom HTML' );
await page.keyboard.type( '<a>' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( 'Random Link' );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( '</a>' );
await publishPost();

// View the post.
const viewPostLinks = await page.$x( "//a[contains(text(), 'View Post')]" );
await viewPostLinks[ 0 ].click();
await page.waitForNavigation();

// Check the the dynamic block appears.
const content = await page.$eval( '.entry-content', ( element ) => element.innerHTML );
expect( content ).toMatchSnapshot();
} );
} );

0 comments on commit 60e22bf

Please sign in to comment.