|
|
@@ -202,14 +202,13 @@ describe( 'BalloonEditor', () => {
|
|
|
const fired = [];
|
|
|
|
|
|
function spy( evt ) {
|
|
|
- fired.push( evt.name );
|
|
|
+ fired.push( `${ evt.name }-${ evt.source.constructor.name.toLowerCase() }` );
|
|
|
}
|
|
|
|
|
|
class EventWatcher extends Plugin {
|
|
|
init() {
|
|
|
- this.editor.on( 'pluginsReady', spy );
|
|
|
this.editor.ui.on( 'ready', spy );
|
|
|
- this.editor.on( 'dataReady', spy );
|
|
|
+ this.editor.data.on( 'ready', spy );
|
|
|
this.editor.on( 'ready', spy );
|
|
|
}
|
|
|
}
|
|
|
@@ -219,29 +218,8 @@ describe( 'BalloonEditor', () => {
|
|
|
plugins: [ EventWatcher ]
|
|
|
} )
|
|
|
.then( newEditor => {
|
|
|
- expect( fired ).to.deep.equal( [ 'pluginsReady', 'ready', 'dataReady', 'ready' ] );
|
|
|
-
|
|
|
- editor = newEditor;
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'fires dataReady once data is loaded', () => {
|
|
|
- let data;
|
|
|
-
|
|
|
- class EventWatcher extends Plugin {
|
|
|
- init() {
|
|
|
- this.editor.on( 'dataReady', () => {
|
|
|
- data = this.editor.getData();
|
|
|
- } );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return BalloonEditor
|
|
|
- .create( editorElement, {
|
|
|
- plugins: [ EventWatcher, Paragraph, Bold ]
|
|
|
- } )
|
|
|
- .then( newEditor => {
|
|
|
- expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
|
|
|
+ expect( fired ).to.deep.equal(
|
|
|
+ [ 'ready-ballooneditorui', 'ready-datacontroller', 'ready-ballooneditor' ] );
|
|
|
|
|
|
editor = newEditor;
|
|
|
} );
|