|
|
@@ -20,6 +20,7 @@ import ElementApiMixin from '@ckeditor/ckeditor5-core/src/editor/utils/elementap
|
|
|
import RootElement from '@ckeditor/ckeditor5-engine/src/model/rootelement';
|
|
|
|
|
|
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
|
|
|
+import log from '@ckeditor/ckeditor5-utils/src/log';
|
|
|
|
|
|
describe( 'BalloonEditor', () => {
|
|
|
let editor, editorElement;
|
|
|
@@ -31,6 +32,8 @@ describe( 'BalloonEditor', () => {
|
|
|
editorElement.innerHTML = '<p><strong>foo</strong> bar</p>';
|
|
|
|
|
|
document.body.appendChild( editorElement );
|
|
|
+
|
|
|
+ testUtils.sinon.stub( log, 'warn' ).callsFake( () => {} );
|
|
|
} );
|
|
|
|
|
|
afterEach( () => {
|
|
|
@@ -211,6 +214,7 @@ describe( 'BalloonEditor', () => {
|
|
|
class EventWatcher extends Plugin {
|
|
|
init() {
|
|
|
this.editor.on( 'pluginsReady', spy );
|
|
|
+ this.editor.ui.on( 'ready', spy );
|
|
|
this.editor.on( 'uiReady', spy );
|
|
|
this.editor.on( 'dataReady', spy );
|
|
|
this.editor.on( 'ready', spy );
|
|
|
@@ -222,7 +226,7 @@ describe( 'BalloonEditor', () => {
|
|
|
plugins: [ EventWatcher ]
|
|
|
} )
|
|
|
.then( newEditor => {
|
|
|
- expect( fired ).to.deep.equal( [ 'pluginsReady', 'uiReady', 'dataReady', 'ready' ] );
|
|
|
+ expect( fired ).to.deep.equal( [ 'pluginsReady', 'ready', 'uiReady', 'dataReady', 'ready' ] );
|
|
|
|
|
|
editor = newEditor;
|
|
|
} );
|
|
|
@@ -271,6 +275,28 @@ describe( 'BalloonEditor', () => {
|
|
|
editor = newEditor;
|
|
|
} );
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'fires ready once UI is ready', () => {
|
|
|
+ let isRendered;
|
|
|
+
|
|
|
+ class EventWatcher extends Plugin {
|
|
|
+ init() {
|
|
|
+ this.editor.ui.on( 'ready', () => {
|
|
|
+ isRendered = this.editor.ui.view.isRendered;
|
|
|
+ } );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return BalloonEditor
|
|
|
+ .create( editorElement, {
|
|
|
+ plugins: [ EventWatcher ]
|
|
|
+ } )
|
|
|
+ .then( newEditor => {
|
|
|
+ expect( isRendered ).to.be.true;
|
|
|
+
|
|
|
+ editor = newEditor;
|
|
|
+ } );
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
describe( 'destroy()', () => {
|