|
@@ -55,6 +55,26 @@ CKEDITOR.define( 'plugin!G', function() {
|
|
|
throw new TestError( 'Some error inside a plugin' );
|
|
throw new TestError( 'Some error inside a plugin' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+CKEDITOR.define( 'plugin!H', [ 'plugin', 'plugin!H/a' ], function( Plugin ) {
|
|
|
|
|
+ return class extends Plugin {};
|
|
|
|
|
+} );
|
|
|
|
|
+
|
|
|
|
|
+var spies = {};
|
|
|
|
|
+// Note: This is NOT a plugin.
|
|
|
|
|
+CKEDITOR.define( 'plugin!H/a', [ 'plugin!H/a/b' ], function() {
|
|
|
|
|
+ return ( spies[ 'plugin!H/a' ] = sinon.spy() );
|
|
|
|
|
+} );
|
|
|
|
|
+
|
|
|
|
|
+// Note: This is NOT a plugin.
|
|
|
|
|
+CKEDITOR.define( 'plugin!H/a/b', [ 'c' ], function() {
|
|
|
|
|
+ return ( spies[ 'plugin!H/a/b' ] = sinon.spy() );
|
|
|
|
|
+} );
|
|
|
|
|
+
|
|
|
|
|
+// Note: This is NOT a plugin.
|
|
|
|
|
+CKEDITOR.define( 'c', function() {
|
|
|
|
|
+ return ( spies.c = sinon.spy() );
|
|
|
|
|
+} );
|
|
|
|
|
+
|
|
|
/////////////
|
|
/////////////
|
|
|
|
|
|
|
|
describe( 'load', function() {
|
|
describe( 'load', function() {
|
|
@@ -219,6 +239,30 @@ describe( 'load', function() {
|
|
|
expect( logSpy.args[ 0 ][ 0 ] ).to.match( /^plugincollection-load:/ );
|
|
expect( logSpy.args[ 0 ][ 0 ] ).to.match( /^plugincollection-load:/ );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should load `deps` which are not plugins', function() {
|
|
|
|
|
+ var PluginCollection = modules.plugincollection;
|
|
|
|
|
+
|
|
|
|
|
+ var plugins = new PluginCollection( editor );
|
|
|
|
|
+ expect( spies ).to.be.empty;
|
|
|
|
|
+
|
|
|
|
|
+ return plugins.load( 'H' )
|
|
|
|
|
+ .then( function() {
|
|
|
|
|
+ expect( plugins.get( 'H' ).deps ).to.deep.equal( [ 'H/a' ] );
|
|
|
|
|
+
|
|
|
|
|
+ // Non–plugin dependencies should be loaded (spy exists)...
|
|
|
|
|
+ expect( spies ).to.have.keys( [
|
|
|
|
|
+ 'plugin!H/a', 'plugin!H/a/b', 'c'
|
|
|
|
|
+ ] );
|
|
|
|
|
+
|
|
|
|
|
+ // ...but not be executed (called == false)...
|
|
|
|
|
+ expect( spies[ 'plugin!H/a' ].called ).to.be.false;
|
|
|
|
|
+ expect( spies[ 'plugin!H/a/b' ].called ).to.be.false;
|
|
|
|
|
+ expect( spies.c.called ).to.be.false;
|
|
|
|
|
+
|
|
|
|
|
+ expect( plugins.length ).to.be.equal( 1 );
|
|
|
|
|
+ } );
|
|
|
|
|
+ } );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( 'add', function() {
|
|
describe( 'add', function() {
|