Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge branch 'master' into t/ckeditor5/479
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Jan 29, 2019
2 parents 9b8c12e + 61ccab0 commit ab3b069
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
5 changes: 1 addition & 4 deletions src/classiceditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,7 @@ export default class ClassicEditor extends Editor {

return editor.data.init( initialData );
} )
.then( () => {
editor.fire( 'dataReady' );
editor.fire( 'ready' );
} )
.then( () => editor.fire( 'ready' ) )
.then( () => editor )
);
} );
Expand Down
30 changes: 4 additions & 26 deletions tests/classiceditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,13 @@ describe( 'ClassicEditor', () => {
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 );
}
}
Expand All @@ -204,29 +203,8 @@ describe( 'ClassicEditor', () => {
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 ClassicEditor
.create( editorElement, {
plugins: [ EventWatcher, Paragraph, Bold ]
} )
.then( newEditor => {
expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
expect( fired ).to.deep.equal(
[ 'ready-classiceditorui', 'ready-datacontroller', 'ready-classiceditor' ] );

editor = newEditor;
} );
Expand Down
1 change: 0 additions & 1 deletion tests/classiceditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ class VirtualClassicTestEditor extends VirtualTestEditor {
editor.initPlugins()
.then( () => {
editor.ui.init();
editor.fire( 'dataReady' );
editor.fire( 'ready' );
} )
.then( () => editor )
Expand Down

0 comments on commit ab3b069

Please sign in to comment.