|
@@ -19,6 +19,7 @@ import DataApiMixin from '@ckeditor/ckeditor5-core/src/editor/utils/dataapimixin
|
|
|
import ElementApiMixin from '@ckeditor/ckeditor5-core/src/editor/utils/elementapimixin';
|
|
import ElementApiMixin from '@ckeditor/ckeditor5-core/src/editor/utils/elementapimixin';
|
|
|
import RootElement from '@ckeditor/ckeditor5-engine/src/model/rootelement';
|
|
import RootElement from '@ckeditor/ckeditor5-engine/src/model/rootelement';
|
|
|
|
|
|
|
|
|
|
+import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
|
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
|
|
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
|
|
|
import log from '@ckeditor/ckeditor5-utils/src/log';
|
|
import log from '@ckeditor/ckeditor5-utils/src/log';
|
|
|
|
|
|
|
@@ -117,6 +118,13 @@ describe( 'BalloonEditor', () => {
|
|
|
return newEditor.destroy();
|
|
return newEditor.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ // See: https://github.com/ckeditor/ckeditor5/issues/746
|
|
|
|
|
+ it( 'should throw when trying to create the editor using the same source element more than once', () => {
|
|
|
|
|
+ expect( () => {
|
|
|
|
|
+ new BalloonEditor( editorElement, { plugins: [] } ); // eslint-disable-line no-new
|
|
|
|
|
+ } ).to.throw( CKEditorError, /^securesourceelement-source-element-used-more-than-once/ );
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( 'create()', () => {
|
|
describe( 'create()', () => {
|
|
@@ -158,6 +166,9 @@ describe( 'BalloonEditor', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should not require config object', () => {
|
|
it( 'should not require config object', () => {
|
|
|
|
|
+ const editorElement = document.createElement( 'div' );
|
|
|
|
|
+ editorElement.innerHTML = '<p><strong>foo</strong> bar</p>';
|
|
|
|
|
+
|
|
|
// Just being safe with `builtinPlugins` static property.
|
|
// Just being safe with `builtinPlugins` static property.
|
|
|
class CustomBalloonEditor extends BalloonEditor {}
|
|
class CustomBalloonEditor extends BalloonEditor {}
|
|
|
CustomBalloonEditor.builtinPlugins = [ Paragraph, Bold ];
|
|
CustomBalloonEditor.builtinPlugins = [ Paragraph, Bold ];
|
|
@@ -167,6 +178,9 @@ describe( 'BalloonEditor', () => {
|
|
|
expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
|
|
expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
|
|
|
|
|
|
|
|
return newEditor.destroy();
|
|
return newEditor.destroy();
|
|
|
|
|
+ } )
|
|
|
|
|
+ .then( () => {
|
|
|
|
|
+ editorElement.remove();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -181,13 +195,18 @@ describe( 'BalloonEditor', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'initializes with config.initialData', () => {
|
|
it( 'initializes with config.initialData', () => {
|
|
|
|
|
+ const editorElement = document.createElement( 'div' );
|
|
|
|
|
+ editorElement.innerHTML = '<p><strong>foo</strong> bar</p>';
|
|
|
|
|
+
|
|
|
return BalloonEditor.create( editorElement, {
|
|
return BalloonEditor.create( editorElement, {
|
|
|
initialData: '<p>Hello world!</p>',
|
|
initialData: '<p>Hello world!</p>',
|
|
|
plugins: [ Paragraph ]
|
|
plugins: [ Paragraph ]
|
|
|
} ).then( editor => {
|
|
} ).then( editor => {
|
|
|
expect( editor.getData() ).to.equal( '<p>Hello world!</p>' );
|
|
expect( editor.getData() ).to.equal( '<p>Hello world!</p>' );
|
|
|
|
|
|
|
|
- editor.destroy();
|
|
|
|
|
|
|
+ return editor.destroy();
|
|
|
|
|
+ } ).then( () => {
|
|
|
|
|
+ editorElement.remove();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|