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

Added missing test, removed dead code.

Maciej Bukowski 6 лет назад
Родитель
Сommit
a0073b7f6e

+ 1 - 1
packages/ckeditor5-core/src/editor/editor.js

@@ -229,7 +229,7 @@ export default class Editor {
 	 */
 	initPlugins() {
 		const config = this.config;
-		const plugins = config.get( 'plugins' ) || [];
+		const plugins = config.get( 'plugins' );
 		const removePlugins = config.get( 'removePlugins' ) || [];
 		const extraPlugins = config.get( 'extraPlugins' ) || [];
 

+ 16 - 0
packages/ckeditor5-core/tests/editor/editor.js

@@ -265,6 +265,22 @@ describe( 'Editor', () => {
 			expect( editor.config.get( 'plugins' ) ).to.be.empty;
 		} );
 
+		it( 'should copy builtin plugins', async () => {
+			TestEditor.builtinPlugins = [ PluginA ];
+
+			class ContextPlugin {
+				static get isContextPlugin() {
+					return true;
+				}
+			}
+
+			const context = await Context.create( { plugins: [ ContextPlugin ] } );
+			const editor = await TestEditor.create( { context } );
+
+			expect( editor.config.get( 'plugins' ) ).to.deep.equal( [ PluginA ] );
+			expect( editor.config.get( 'plugins' ) ).to.not.equal( TestEditor.builtinPlugins );
+		} );
+
 		it( 'should pass DOM element using reference, not copy', async () => {
 			const element = document.createElement( 'div' );
 			const context = await Context.create( { efoo: element } );