8
0
Просмотр исходного кода

Tests: Adjust unit tests to new event.

Krzysztof Krztoń 7 лет назад
Родитель
Сommit
920aad0be7

+ 8 - 3
packages/ckeditor5-core/tests/_utils-tests/classictesteditor.js

@@ -116,12 +116,12 @@ describe( 'ClassicTestEditor', () => {
 			const fired = [];
 			const fired = [];
 
 
 			function spy( evt ) {
 			function spy( evt ) {
-				fired.push( evt.name );
+				fired.push( `${ evt.name }-${ evt.source.constructor.name.toLowerCase() }` );
 			}
 			}
 
 
 			class EventWatcher extends Plugin {
 			class EventWatcher extends Plugin {
 				init() {
 				init() {
-					this.editor.on( 'pluginsReady', spy );
+					this.editor.plugins.on( 'ready', spy );
 					this.editor.ui.on( 'ready', spy );
 					this.editor.ui.on( 'ready', spy );
 					this.editor.on( 'dataReady', spy );
 					this.editor.on( 'dataReady', spy );
 					this.editor.on( 'ready', spy );
 					this.editor.on( 'ready', spy );
@@ -133,7 +133,12 @@ describe( 'ClassicTestEditor', () => {
 					plugins: [ EventWatcher ]
 					plugins: [ EventWatcher ]
 				} )
 				} )
 				.then( editor => {
 				.then( editor => {
-					expect( fired ).to.deep.equal( [ 'pluginsReady', 'ready', 'dataReady', 'ready' ] );
+					expect( fired ).to.deep.equal( [
+						'ready-plugincollection',
+						'ready-classictesteditorui',
+						'dataReady-classictesteditor',
+						'ready-classictesteditor'
+					] );
 
 
 					return editor.destroy();
 					return editor.destroy();
 				} );
 				} );

+ 9 - 9
packages/ckeditor5-core/tests/editor/editor.js

@@ -380,12 +380,12 @@ describe( 'Editor', () => {
 			const fired = [];
 			const fired = [];
 
 
 			function spy( evt ) {
 			function spy( evt ) {
-				fired.push( evt.name );
+				fired.push( `${ evt.name }-${ evt.source.constructor.name.toLowerCase() }` );
 			}
 			}
 
 
 			class EventWatcher extends Plugin {
 			class EventWatcher extends Plugin {
 				init() {
 				init() {
-					this.editor.on( 'pluginsReady', spy );
+					this.editor.plugins.on( 'ready', spy );
 					this.editor.on( 'dataReady', spy );
 					this.editor.on( 'dataReady', spy );
 					this.editor.on( 'ready', spy );
 					this.editor.on( 'ready', spy );
 				}
 				}
@@ -393,7 +393,7 @@ describe( 'Editor', () => {
 
 
 			return Editor.create( { plugins: [ EventWatcher ] } )
 			return Editor.create( { plugins: [ EventWatcher ] } )
 				.then( () => {
 				.then( () => {
-					expect( fired ).to.deep.equal( [ 'pluginsReady', 'dataReady', 'ready' ] );
+					expect( fired ).to.deep.equal( [ 'ready-plugincollection', 'dataReady-editor', 'ready-editor' ] );
 				} );
 				} );
 		} );
 		} );
 	} );
 	} );
@@ -419,8 +419,8 @@ describe( 'Editor', () => {
 				plugins: [ PluginA, PluginD ]
 				plugins: [ PluginA, PluginD ]
 			} );
 			} );
 
 
-			const pluginsReadySpy = sinon.spy().named( 'pluginsReady' );
-			editor.on( 'pluginsReady', pluginsReadySpy );
+			const pluginsReadySpy = sinon.spy().named( 'ready' );
+			editor.plugins.on( 'ready', pluginsReadySpy );
 
 
 			return editor.initPlugins()
 			return editor.initPlugins()
 				.then( () => {
 				.then( () => {
@@ -738,8 +738,8 @@ describe( 'Editor', () => {
 				plugins: [ PluginA, PluginE ]
 				plugins: [ PluginA, PluginE ]
 			} );
 			} );
 
 
-			const pluginsReadySpy = sinon.spy().named( 'pluginsReady' );
-			editor.on( 'pluginsReady', pluginsReadySpy );
+			const pluginsReadySpy = sinon.spy().named( 'ready' );
+			editor.plugins.on( 'ready', pluginsReadySpy );
 
 
 			return editor.initPlugins()
 			return editor.initPlugins()
 				.then( () => {
 				.then( () => {
@@ -757,8 +757,8 @@ describe( 'Editor', () => {
 				plugins: [ PluginA, PluginF ]
 				plugins: [ PluginA, PluginF ]
 			} );
 			} );
 
 
-			const pluginsReadySpy = sinon.spy().named( 'pluginsReady' );
-			editor.on( 'pluginsReady', pluginsReadySpy );
+			const pluginsReadySpy = sinon.spy().named( 'ready' );
+			editor.plugins.on( 'ready', pluginsReadySpy );
 
 
 			return editor.initPlugins()
 			return editor.initPlugins()
 				.then( () => {
 				.then( () => {