|
|
@@ -6,8 +6,10 @@
|
|
|
/* global document */
|
|
|
|
|
|
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
|
|
|
-
|
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
+import LinkEditing from '@ckeditor/ckeditor5-link/src/linkediting';
|
|
|
+import Delete from '@ckeditor/ckeditor5-typing/src/delete';
|
|
|
+import BoldEditing from '@ckeditor/ckeditor5-basic-styles/src/bold/boldediting';
|
|
|
import ShiftEnter from '../src/shiftenter';
|
|
|
|
|
|
import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
|
@@ -24,7 +26,7 @@ describe( 'ShiftEnter integration', () => {
|
|
|
|
|
|
document.body.appendChild( div );
|
|
|
|
|
|
- return ClassicEditor.create( div, { plugins: [ Paragraph, ShiftEnter ] } )
|
|
|
+ return ClassicEditor.create( div, { plugins: [ Paragraph, ShiftEnter, LinkEditing, Delete, BoldEditing ] } )
|
|
|
.then( newEditor => {
|
|
|
editor = newEditor;
|
|
|
|
|
|
@@ -46,9 +48,26 @@ describe( 'ShiftEnter integration', () => {
|
|
|
it( 'BLOCK_FILLER should be inserted after <br> in the paragraph', () => {
|
|
|
setModelData( model, '<paragraph>[]</paragraph>' );
|
|
|
|
|
|
- editor.commands.get( 'shiftEnter' ).execute();
|
|
|
+ editor.execute( 'shiftEnter' );
|
|
|
|
|
|
expect( editor.getData( { trim: 'none' } ) ).to.equal( '<p><br> </p>' );
|
|
|
expect( editor.ui.view.editable.element.innerHTML ).to.equal( '<p><br><br data-cke-filler="true"></p>' );
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'should not inherit text attributes before the "softBreak" element', () => {
|
|
|
+ setModelData( model,
|
|
|
+ '<paragraph>' +
|
|
|
+ '<$text linkHref="foo" bold="true">Bolded link</$text>' +
|
|
|
+ '<softBreak></softBreak>' +
|
|
|
+ 'F[]' +
|
|
|
+ '</paragraph>'
|
|
|
+ );
|
|
|
+
|
|
|
+ editor.execute( 'delete' );
|
|
|
+
|
|
|
+ const selection = model.document.selection;
|
|
|
+
|
|
|
+ expect( selection.hasAttribute( 'linkHref' ) ).to.equal( false );
|
|
|
+ expect( selection.hasAttribute( 'bold' ) ).to.equal( false );
|
|
|
+ } );
|
|
|
} );
|