|
|
@@ -9,6 +9,8 @@ import BalloonToolbarEditorUI from '../src/balloontoolbareditorui';
|
|
|
import BalloonToolbarEditorUIView from '../src/balloontoolbareditoruiview';
|
|
|
|
|
|
import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
|
|
|
+import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter';
|
|
|
+import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildmodelconverter';
|
|
|
|
|
|
import BalloonToolbarEditor from '../src/balloontoolbareditor';
|
|
|
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
|
|
@@ -175,20 +177,39 @@ describe( 'BalloonToolbarEditor', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
- describe( 'destroy', () => {
|
|
|
+ describe( 'destroy()', () => {
|
|
|
beforeEach( function() {
|
|
|
return BalloonToolbarEditor.create( editorElement, { plugins: [ Paragraph ] } )
|
|
|
.then( newEditor => {
|
|
|
editor = newEditor;
|
|
|
+
|
|
|
+ const schema = editor.document.schema;
|
|
|
+
|
|
|
+ schema.registerItem( 'heading' );
|
|
|
+ schema.allow( { name: 'heading', inside: '$root' } );
|
|
|
+ schema.allow( { name: '$text', inside: 'heading' } );
|
|
|
+
|
|
|
+ buildModelConverter().for( editor.data.modelToView )
|
|
|
+ .fromElement( 'heading' )
|
|
|
+ .toElement( 'heading' );
|
|
|
+
|
|
|
+ buildViewConverter().for( editor.data.viewToModel )
|
|
|
+ .fromElement( 'heading' )
|
|
|
+ .toElement( 'heading' );
|
|
|
+
|
|
|
+ buildModelConverter().for( editor.editing.modelToView )
|
|
|
+ .fromElement( 'heading' )
|
|
|
+ .toElement( 'heading-editing-representation' );
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
it( 'sets the data back to the editor element', () => {
|
|
|
- editor.setData( '<p>foo</p>' );
|
|
|
+ editor.setData( '<p>a</p><heading>b</heading>' );
|
|
|
|
|
|
return editor.destroy()
|
|
|
.then( () => {
|
|
|
- expect( editorElement.innerHTML ).to.equal( '<p>foo</p>' );
|
|
|
+ expect( editorElement.innerHTML )
|
|
|
+ .to.equal( '<p>a</p><heading>b</heading>' );
|
|
|
} );
|
|
|
} );
|
|
|
} );
|