From 4e9fdf1a5c8743e989c2a346af5b725988f9b74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krzto=C5=84?= Date: Thu, 24 Jan 2019 11:27:55 +0100 Subject: [PATCH] Adjustments to new data#ready event. --- src/inlineeditor.js | 5 +---- tests/inlineeditor.js | 26 ++------------------------ tests/inlineeditorui.js | 1 - 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/inlineeditor.js b/src/inlineeditor.js index d04d659..31229aa 100644 --- a/src/inlineeditor.js +++ b/src/inlineeditor.js @@ -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 ) ); } ); diff --git a/tests/inlineeditor.js b/tests/inlineeditor.js index b8b42f9..e13889f 100644 --- a/tests/inlineeditor.js +++ b/tests/inlineeditor.js @@ -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 ); } } @@ -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( '

foo bar

' ); + 'ready-plugincollection', 'ready-inlineeditorui', 'ready-datacontroller', 'ready-inlineeditor' ] ); editor = newEditor; } ); diff --git a/tests/inlineeditorui.js b/tests/inlineeditorui.js index 80eeb3b..9f64a4f 100644 --- a/tests/inlineeditorui.js +++ b/tests/inlineeditorui.js @@ -257,7 +257,6 @@ class VirtualInlineTestEditor extends VirtualTestEditor { editor.initPlugins() .then( () => { editor.ui.init(); - editor.fire( 'dataReady' ); editor.fire( 'ready' ); } ) .then( () => editor )