diff --git a/packages/ckeditor5-clipboard/tests/pasting-integration.js b/packages/ckeditor5-clipboard/tests/pasting-integration.js index 20ec82166e2..295ae47ec20 100644 --- a/packages/ckeditor5-clipboard/tests/pasting-integration.js +++ b/packages/ckeditor5-clipboard/tests/pasting-integration.js @@ -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, '[]' ); + + pasteText( editor, 'https://example.com?x=1"=2×tamp=t' ); + + expect( getData( editor.model ) ).to.equal( + 'https://example.com?x=1"=2×tamp=t[]' // keeps """ and "×" unchanged + ); + + return editor.destroy(); + } ); + } ); + } ); } ); function pasteHtml( editor, html ) { @@ -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 ) {