浏览代码

Tests: Improved the tests.

Piotrek Koszuliński 8 年之前
父节点
当前提交
561c4d9b8e
共有 1 个文件被更改,包括 33 次插入7 次删除
  1. 33 7
      packages/ckeditor5-core/tests/editor/editor.js

+ 33 - 7
packages/ckeditor5-core/tests/editor/editor.js

@@ -296,7 +296,7 @@ describe( 'Editor', () => {
 				plugins: [ PluginA, PluginB, PluginC ]
 			};
 
-			const editor = new Editor( {} );
+			const editor = new Editor();
 
 			return editor.initPlugins()
 				.then( () => {
@@ -315,7 +315,7 @@ describe( 'Editor', () => {
 
 			const editor = new Editor( {
 				plugins: [
-					'A',
+					'A'
 				]
 			} );
 
@@ -328,6 +328,8 @@ describe( 'Editor', () => {
 		} );
 
 		it( 'should load plugins built in the Editor using their names', () => {
+			class PrivatePlugin extends Plugin {}
+
 			Editor.build = {
 				plugins: [ PluginA, PluginB, PluginC, PluginD ]
 			};
@@ -336,17 +338,19 @@ describe( 'Editor', () => {
 				plugins: [
 					'A',
 					'B',
-					'C'
+					'C',
+					PrivatePlugin
 				]
 			} );
 
 			return editor.initPlugins()
 				.then( () => {
-					expect( getPlugins( editor ).length ).to.equal( 3 );
+					expect( getPlugins( editor ).length ).to.equal( 4 );
 
 					expect( editor.plugins.get( PluginA ) ).to.be.an.instanceof( Plugin );
 					expect( editor.plugins.get( PluginB ) ).to.be.an.instanceof( Plugin );
 					expect( editor.plugins.get( PluginC ) ).to.be.an.instanceof( Plugin );
+					expect( editor.plugins.get( PrivatePlugin ) ).to.be.an.instanceof( PrivatePlugin );
 				} );
 		} );
 
@@ -355,12 +359,34 @@ describe( 'Editor', () => {
 				plugins: [ PluginA, PluginB, PluginC, PluginD ]
 			};
 
-			class CustomEditor extends Editor {
-			}
+			class CustomEditor extends Editor {}
+
+			const editor = new CustomEditor( {
+				plugins: [
+					'D'
+				]
+			} );
+
+			return editor.initPlugins()
+				.then( () => {
+					expect( getPlugins( editor ).length ).to.equal( 3 );
+
+					expect( editor.plugins.get( PluginB ) ).to.be.an.instanceof( Plugin );
+					expect( editor.plugins.get( PluginC ) ).to.be.an.instanceof( Plugin );
+					expect( editor.plugins.get( PluginD ) ).to.be.an.instanceof( Plugin );
+				} );
+		} );
+
+		it( 'should load plugins build into Editor\'s subclass', () => {
+			class CustomEditor extends Editor {}
+
+			CustomEditor.build = {
+				plugins: [ PluginA, PluginB, PluginC, PluginD ]
+			};
 
 			const editor = new CustomEditor( {
 				plugins: [
-					'D',
+					'D'
 				]
 			} );