Skip to content

Commit

Permalink
Added integration test.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmotyczynska committed Oct 25, 2023
1 parent 42f8906 commit 9123b4a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/ckeditor5-clipboard/tests/pasting-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,25 @@ describe( 'Pasting – integration', () => {
} );
} );
} );

describe( 'links', () => {
// See https://github.com/ckeditor/ckeditor5/issues/15036.
it( 'should not convert parts of the link address which look like HTML entities', () => {
return ClassicTestEditor
.create( element, { plugins: [ Clipboard, Paragraph, Bold, Italic, Link ] } )
.then( editor => {
setData( editor.model, '<paragraph>[]</paragraph>' );

pasteText( editor, 'https://example.com?x=1&quot=2&timestamp=t' );

expect( getData( editor.model ) ).to.equal(
'<paragraph>https://example.com?x=1&quot=2&timestamp=t[]</paragraph>' // keeps "&quot" and "&times" unchanged
);

return editor.destroy();
} );
} );
} );
} );

function pasteHtml( editor, html ) {
Expand All @@ -201,6 +220,14 @@ function pasteHtml( editor, html ) {
} );
}

function pasteText( editor, text ) {
editor.editing.view.document.fire( 'paste', {
dataTransfer: createDataTransfer( { 'text/plain': text } ),
stopPropagation() {},
preventDefault() {}
} );
}

function createDataTransfer( data ) {
return {
getData( type ) {
Expand Down

0 comments on commit 9123b4a

Please sign in to comment.