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

Commit

Permalink
Adjustments to new data#ready event.
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Jan 24, 2019
1 parent 10a8344 commit 4e9fdf1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
5 changes: 1 addition & 4 deletions src/inlineeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,7 @@ export default class InlineEditor extends Editor {

return editor.data.init( initialData );
} )
.then( () => {
editor.fire( 'dataReady' );
editor.fire( 'ready' );
} )
.then( () => editor.fire( 'ready' ) )
.then( () => editor )
);
} );
Expand Down
26 changes: 2 additions & 24 deletions tests/inlineeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ describe( 'InlineEditor', () => {
init() {
this.editor.plugins.on( 'ready', 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 @@ -210,29 +210,7 @@ describe( 'InlineEditor', () => {
} )
.then( newEditor => {
expect( fired ).to.deep.equal( [
'ready-plugincollection', 'ready-inlineeditorui', 'dataReady-inlineeditor', 'ready-inlineeditor' ] );

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 InlineEditor
.create( editorElement, {
plugins: [ EventWatcher, Paragraph, Bold ]
} )
.then( newEditor => {
expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
'ready-plugincollection', 'ready-inlineeditorui', 'ready-datacontroller', 'ready-inlineeditor' ] );

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

0 comments on commit 4e9fdf1

Please sign in to comment.