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

Commit

Permalink
Internal: Removed checking whether the dependencies of loaded plugin …
Browse files Browse the repository at this point in the history
…exist.
  • Loading branch information
Kamil Piechaczek committed Mar 1, 2017
1 parent 53068d4 commit 80771ad
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 35 deletions.
14 changes: 0 additions & 14 deletions src/plugincollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export default class PluginCollection {
.then( () => loaded );

function loadPlugin( PluginConstructor ) {
// Don't load the plugin if it cannot be loaded.
if ( pluginConstructorsToRemove.includes( PluginConstructor ) ) {
return;
}
Expand Down Expand Up @@ -163,19 +162,6 @@ export default class PluginCollection {
PluginConstructor.requires.forEach( ( RequiredPluginConstructorOrName ) => {
const RequiredPluginConstructor = getPluginConstructor( RequiredPluginConstructorOrName );

if ( !RequiredPluginConstructor ) {
/**
* The plugin cannot be loaded by name.
*
* @error plugincollection-plugin-not-found
* @param {String} plugin The name of the plugin which could not be loaded.
*/
throw new CKEditorError(
'plugincollection-plugin-not-found: The plugin cannot be loaded by name.',
{ plugins: RequiredPluginConstructorOrName }
);
}

if ( removePlugins.includes( RequiredPluginConstructor ) ) {
/**
* Cannot load a plugin because one of its dependencies is listed in the `removePlugins` options.
Expand Down
21 changes: 0 additions & 21 deletions tests/plugincollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,27 +336,6 @@ describe( 'PluginCollection', () => {
expect( logSpy.calledTwice ).to.equal( true );
} );
} );

it( 'should reject when loaded plugin requires non-existing plugin', () => {
let logSpy = testUtils.sinon.stub( log, 'error' );

let plugins = new PluginCollection( editor, availablePlugins );

PluginA.requires = [ 'NonExistentPlugin' ];

return plugins.load( [ PluginA ] )
// Throw here, so if by any chance plugins.load() was resolved correctly catch() will be stil executed.
.then( () => {
throw new Error( 'Test error: this promise should not be resolved successfully' );
} )
.catch( ( err ) => {
expect( err ).to.be.an.instanceof( CKEditorError );
expect( err.message ).to.match( /^plugincollection-plugin-not-found/ );

sinon.assert.calledOnce( logSpy );
expect( logSpy.args[ 0 ][ 0 ] ).to.match( /^plugincollection-load:/ );
} );
} );
} );

describe( 'get()', () => {
Expand Down

0 comments on commit 80771ad

Please sign in to comment.