|
@@ -7,10 +7,13 @@
|
|
|
|
|
|
|
|
'use strict';
|
|
'use strict';
|
|
|
|
|
|
|
|
-var modules = bender.amd.require( 'plugincollection', 'plugin', 'editor', 'ckeditorerror' );
|
|
|
|
|
|
|
+var modules = bender.amd.require( 'plugincollection', 'plugin', 'editor', 'log' );
|
|
|
var editor;
|
|
var editor;
|
|
|
var PluginA, PluginB;
|
|
var PluginA, PluginB;
|
|
|
|
|
|
|
|
|
|
+var sandbox = sinon.sandbox.create();
|
|
|
|
|
+afterEach( sandbox.restore.bind( sandbox ) );
|
|
|
|
|
+
|
|
|
before( function() {
|
|
before( function() {
|
|
|
var Editor = modules.editor;
|
|
var Editor = modules.editor;
|
|
|
var Plugin = modules.plugin;
|
|
var Plugin = modules.plugin;
|
|
@@ -169,7 +172,9 @@ describe( 'load', function() {
|
|
|
|
|
|
|
|
it( 'should throw an error for invalid plugins', function() {
|
|
it( 'should throw an error for invalid plugins', function() {
|
|
|
var PluginCollection = modules.plugincollection;
|
|
var PluginCollection = modules.plugincollection;
|
|
|
- var CKEditorError = modules.ckeditorerror;
|
|
|
|
|
|
|
+ var log = modules.log;
|
|
|
|
|
+
|
|
|
|
|
+ var logSpy = sandbox.stub( log, 'error' );
|
|
|
|
|
|
|
|
var plugins = new PluginCollection( editor );
|
|
var plugins = new PluginCollection( editor );
|
|
|
|
|
|
|
@@ -178,8 +183,12 @@ describe( 'load', function() {
|
|
|
throw new Error( 'Test error: this promise should not be resolved successfully' );
|
|
throw new Error( 'Test error: this promise should not be resolved successfully' );
|
|
|
} )
|
|
} )
|
|
|
.catch( function( err ) {
|
|
.catch( function( err ) {
|
|
|
- expect( err ).to.be.an.instanceof( CKEditorError );
|
|
|
|
|
- expect( err.data ).to.have.property( 'plugin', 'BAD' );
|
|
|
|
|
|
|
+ expect( err ).to.be.an.instanceof( Error );
|
|
|
|
|
+ // Make sure it's the Require.JS error, not the one thrown above.
|
|
|
|
|
+ expect( err ).to.have.property( 'requireType', 'scripterror' );
|
|
|
|
|
+
|
|
|
|
|
+ sinon.assert.calledOnce( logSpy );
|
|
|
|
|
+ expect( logSpy.args[ 0 ][ 0 ] ).to.match( /^plugincollection-load:/ );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|