Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jul 15, 2022
1 parent b4248a5 commit f8e66f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello World
19 changes: 19 additions & 0 deletions test/e2e/specs/editor/various/copy-cut-paste.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,23 @@ test.describe( 'Copy/cut/paste', () => {
await pageUtils.pressKeyWithModifier( 'primary', 'v' );
expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );

test( 'should paste single line in post title', async ( {
page,
pageUtils,
} ) => {
// This test checks whether we are correctly handling single line
// pasting in the post title. Previously we were accidentally falling
// back to default browser behaviour, allowing the browser to insert
// unfiltered HTML. When we swap out the post title in the post editor
// with the proper block, this test can be removed.
await pageUtils.setClipboardData( {
html: '<span style="border: 1px solid black">Hello World</span>',
} );
await pageUtils.pressKeyWithModifier( 'primary', 'v' );
// Expect the span to be filtered out.
expect(
await page.evaluate( () => document.activeElement.innerHTML )
).toMatchSnapshot();
} );
} );

0 comments on commit f8e66f6

Please sign in to comment.