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

Commit

Permalink
Merge branch 'master' into context
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Jan 27, 2020
2 parents 2f5d35b + b98b457 commit 854ffbd
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
indent_style = space
tab_width = 2
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -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
*/

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Software License Agreement
==========================

**CKEditor 5 Cloud Services**https://github.com/ckeditor/ckeditor5-cloud-services <br>
Copyright (c) 2003-2019, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.
Copyright (c) 2003-2020, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.

Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).

Expand Down
11 changes: 10 additions & 1 deletion src/cloudservices.js
Original file line number Diff line number Diff line change
@@ -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
*/

Expand Down Expand Up @@ -185,6 +185,15 @@ CloudServices.Token = Token;
* @member {String} module:cloud-services/cloudservices~CloudServicesConfig#webSocketUrl
*/

/**
* Optional parameter used for integration with Cloud Services, when uploading the editor build to Cloud Services.
*
* Whenever the editor build or the configuration changes, this parameter should be set to a new, unique value, to differentiate
* the new bundle (build + configuration) from the old ones.
*
* @member {String} module:cloud-services/cloudservices~CloudServicesConfig#bundleVersion
*/

/**
* Document ID, used by the `RealTimeCollaborativeEditing` plugin. All editor instances created with the same document ID will collaborate.
* It means that each document needs a different document ID if you do not want to start collaboration between these documents.
Expand Down
2 changes: 1 addition & 1 deletion tests/_utils/cloud-services-config.js
Original file line number Diff line number Diff line change
@@ -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
*/

Expand Down
2 changes: 1 addition & 1 deletion tests/_utils/tokenmock.js
Original file line number Diff line number Diff line change
@@ -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
*/

Expand Down
46 changes: 26 additions & 20 deletions tests/cloudservices.js
Original file line number Diff line number Diff line change
@@ -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
*/

Expand Down Expand Up @@ -36,14 +36,14 @@ describe( 'CloudServices', () => {
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.tokenUrl ).to.equal( 'http://token-endpoint' );
expect( cloudServicesPlugin.additionalOption ).to.equal( 'some-value' );

return editor.destroy();
return context.destroy();
} );
} );

Expand All @@ -57,32 +57,34 @@ describe( 'CloudServices', () => {
}
} )
.then( editor => {
const cloudServicesPlugin = editor.plugins.get( CloudServices );

const cloudServicesPlugin = editor.plugins.get( '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();
} );
} );

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 );

return context.destroy();
} );
} );

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', () => {
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;

return context.destroy();
} );
} );

Expand All @@ -94,10 +96,12 @@ describe( 'CloudServices', () => {
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/' );

return context.destroy();
} );
} );

Expand All @@ -111,22 +115,24 @@ describe( 'CloudServices', () => {
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' );

return editor.destroy();
return context.destroy();
} );
} );

it( 'should not provide token if tokenUrl is not provided', () => {
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 );

return context.destroy();
} );
} );
} );
Expand Down
2 changes: 1 addition & 1 deletion tests/manual/token.js
Original file line number Diff line number Diff line change
@@ -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
*/

Expand Down

0 comments on commit 854ffbd

Please sign in to comment.