|
@@ -1,5 +1,5 @@
|
|
|
/**
|
|
/**
|
|
|
- * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
|
|
|
|
|
|
|
+ * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
|
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
@@ -36,14 +36,14 @@ describe( 'CloudServices', () => {
|
|
|
additionalOption: 'some-value'
|
|
additionalOption: 'some-value'
|
|
|
}
|
|
}
|
|
|
} )
|
|
} )
|
|
|
- .then( editor => {
|
|
|
|
|
- const cloudServicesPlugin = editor.plugins.get( CloudServices );
|
|
|
|
|
|
|
+ .then( context => {
|
|
|
|
|
+ const cloudServicesPlugin = context.plugins.get( CloudServices );
|
|
|
|
|
|
|
|
expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
|
|
expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
|
|
|
expect( cloudServicesPlugin.tokenUrl ).to.equal( 'http://token-endpoint' );
|
|
expect( cloudServicesPlugin.tokenUrl ).to.equal( 'http://token-endpoint' );
|
|
|
expect( cloudServicesPlugin.additionalOption ).to.equal( 'some-value' );
|
|
expect( cloudServicesPlugin.additionalOption ).to.equal( 'some-value' );
|
|
|
|
|
|
|
|
- return editor.destroy();
|
|
|
|
|
|
|
+ return context.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -57,32 +57,34 @@ describe( 'CloudServices', () => {
|
|
|
}
|
|
}
|
|
|
} )
|
|
} )
|
|
|
.then( editor => {
|
|
.then( editor => {
|
|
|
- const cloudServicesPlugin = editor.plugins.get( CloudServices );
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const cloudServicesPlugin = editor.plugins.get( 'CloudServices' );
|
|
|
expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
|
|
expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
|
|
|
- expect( cloudServicesPlugin.tokenUrl ).to.equal( 'http://token-endpoint' );
|
|
|
|
|
- expect( cloudServicesPlugin.additionalOption ).to.equal( 'some-value' );
|
|
|
|
|
|
|
|
|
|
return editor.destroy();
|
|
return editor.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should be able to get by its plugin name', () => {
|
|
it( 'should be able to get by its plugin name', () => {
|
|
|
- return Context.create( { plugins: [ CloudServices ] } ).then( editor => {
|
|
|
|
|
- const cloudServicesPlugin = editor.plugins.get( 'CloudServices' );
|
|
|
|
|
|
|
+ return Context.create( { plugins: [ CloudServices ] } ).then( context => {
|
|
|
|
|
+ const cloudServicesPlugin = context.plugins.get( 'CloudServices' );
|
|
|
|
|
+
|
|
|
expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
|
|
expect( cloudServicesPlugin ).to.be.instanceOf( CloudServices );
|
|
|
|
|
+
|
|
|
|
|
+ return context.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should not throw an error when no config is provided', () => {
|
|
it( 'should not throw an error when no config is provided', () => {
|
|
|
- return Context.create( { plugins: [ CloudServices ] } );
|
|
|
|
|
|
|
+ return Context.create( { plugins: [ CloudServices ] } ).then( context => context.destroy() );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should not expose any default uploadUrl', () => {
|
|
it( 'should not expose any default uploadUrl', () => {
|
|
|
- return Context.create( { plugins: [ CloudServices ] } ).then( editor => {
|
|
|
|
|
- const cloudServicesPlugin = editor.plugins.get( CloudServices );
|
|
|
|
|
|
|
+ return Context.create( { plugins: [ CloudServices ] } ).then( context => {
|
|
|
|
|
+ const cloudServicesPlugin = context.plugins.get( CloudServices );
|
|
|
|
|
|
|
|
expect( cloudServicesPlugin.uploadUrl ).to.be.undefined;
|
|
expect( cloudServicesPlugin.uploadUrl ).to.be.undefined;
|
|
|
|
|
+
|
|
|
|
|
+ return context.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -94,10 +96,12 @@ describe( 'CloudServices', () => {
|
|
|
uploadUrl: 'https://some-upload-url/'
|
|
uploadUrl: 'https://some-upload-url/'
|
|
|
}
|
|
}
|
|
|
} )
|
|
} )
|
|
|
- .then( editor => {
|
|
|
|
|
- const cloudServicesPlugin = editor.plugins.get( CloudServices );
|
|
|
|
|
|
|
+ .then( context => {
|
|
|
|
|
+ const cloudServicesPlugin = context.plugins.get( CloudServices );
|
|
|
|
|
|
|
|
expect( cloudServicesPlugin.uploadUrl ).to.equal( 'https://some-upload-url/' );
|
|
expect( cloudServicesPlugin.uploadUrl ).to.equal( 'https://some-upload-url/' );
|
|
|
|
|
+
|
|
|
|
|
+ return context.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -111,22 +115,24 @@ describe( 'CloudServices', () => {
|
|
|
tokenUrl: 'http://token-endpoint',
|
|
tokenUrl: 'http://token-endpoint',
|
|
|
}
|
|
}
|
|
|
} )
|
|
} )
|
|
|
- .then( editor => {
|
|
|
|
|
- const cloudServicesPlugin = editor.plugins.get( CloudServices );
|
|
|
|
|
|
|
+ .then( context => {
|
|
|
|
|
+ const cloudServicesPlugin = context.plugins.get( CloudServices );
|
|
|
|
|
|
|
|
expect( cloudServicesPlugin.token.value ).to.equal( 'initial-token' );
|
|
expect( cloudServicesPlugin.token.value ).to.equal( 'initial-token' );
|
|
|
|
|
|
|
|
- return editor.destroy();
|
|
|
|
|
|
|
+ return context.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should not provide token if tokenUrl is not provided', () => {
|
|
it( 'should not provide token if tokenUrl is not provided', () => {
|
|
|
CloudServices.Token.initialToken = 'initial-token';
|
|
CloudServices.Token.initialToken = 'initial-token';
|
|
|
|
|
|
|
|
- return Context.create( { plugins: [ CloudServices ] } ).then( editor => {
|
|
|
|
|
- const cloudServicesPlugin = editor.plugins.get( CloudServices );
|
|
|
|
|
|
|
+ return Context.create( { plugins: [ CloudServices ] } ).then( context => {
|
|
|
|
|
+ const cloudServicesPlugin = context.plugins.get( CloudServices );
|
|
|
|
|
|
|
|
expect( cloudServicesPlugin.token ).to.equal( null );
|
|
expect( cloudServicesPlugin.token ).to.equal( null );
|
|
|
|
|
+
|
|
|
|
|
+ return context.destroy();
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|