8
0
Piotrek Koszuliński 10 лет назад
Родитель
Сommit
eea969a5b6

+ 5 - 8
dev/bender/plugins/ckeditor5/lib/index.js

@@ -5,8 +5,8 @@
 
 
 'use strict';
 'use strict';
 
 
-var path = require( 'path' );
-var files = [
+const path = require( 'path' );
+const files = [
 	path.join( __dirname, '../static/extensions.js' ),
 	path.join( __dirname, '../static/extensions.js' ),
 	path.join( __dirname, '../static/tools.js' )
 	path.join( __dirname, '../static/tools.js' )
 ];
 ];
@@ -14,13 +14,10 @@ var files = [
 module.exports = {
 module.exports = {
 	name: 'bender-ckeditor5',
 	name: 'bender-ckeditor5',
 
 
-	attach: function() {
-		var that = this;
-		var bender = that;
+	attach() {
+		this.plugins.addFiles( files );
 
 
-		bender.plugins.addFiles( files );
-
-		bender.on( 'test:created', function( test ) {
+		this.on( 'test:created', function( test ) {
 			var name = test.displayName;
 			var name = test.displayName;
 
 
 			name = name.replace( /node_modules\/ckeditor5-core/, 'core: ' );
 			name = name.replace( /node_modules\/ckeditor5-core/, 'core: ' );

+ 6 - 7
dev/bender/plugins/ckeditor5/static/extensions.js

@@ -10,7 +10,7 @@
 
 
 ( function() {
 ( function() {
 	// Make Bender wait to start running tests.
 	// Make Bender wait to start running tests.
-	var done = bender.defer();
+	const done = bender.defer();
 
 
 	// Wait for the "ckeditor" module to be ready to start testing.
 	// Wait for the "ckeditor" module to be ready to start testing.
 	CKEDITOR.require( [ 'ckeditor' ], done );
 	CKEDITOR.require( [ 'ckeditor' ], done );
@@ -25,18 +25,17 @@
 		 * @params {...String} module The name of the module to load.
 		 * @params {...String} module The name of the module to load.
 		 * @returns {Object} The object that will hold the loaded modules.
 		 * @returns {Object} The object that will hold the loaded modules.
 		 */
 		 */
-		require: function() {
-			var modules = {};
+		require() {
+			const modules = {};
+			const done = bender.defer();
 
 
-			var done = bender.defer();
-
-			var names = [].slice.call( arguments );
+			const names = [].slice.call( arguments );
 
 
 			// To avoid race conditions with required modules, require `ckeditor` first and then others. This guarantees
 			// To avoid race conditions with required modules, require `ckeditor` first and then others. This guarantees
 			// that `ckeditor` will be loaded before any other module.
 			// that `ckeditor` will be loaded before any other module.
 			CKEDITOR.require( [ 'ckeditor' ], function() {
 			CKEDITOR.require( [ 'ckeditor' ], function() {
 				CKEDITOR.require( names, function() {
 				CKEDITOR.require( names, function() {
-					for ( var i = 0; i < names.length; i++ ) {
+					for ( let i = 0; i < names.length; i++ ) {
 						modules[ names[ i ] ] = arguments[ i ] ;
 						modules[ names[ i ] ] = arguments[ i ] ;
 					}
 					}
 
 

+ 2 - 2
dev/bender/plugins/ckeditor5/static/tools.js

@@ -40,11 +40,11 @@
 		 *		} );
 		 *		} );
 		 */
 		 */
 		createSinonSandbox() {
 		createSinonSandbox() {
-			before( function() {
+			before( () => {
 				bender.sinon = sinon.sandbox.create();
 				bender.sinon = sinon.sandbox.create();
 			} );
 			} );
 
 
-			afterEach( function() {
+			afterEach( () => {
 				bender.sinon.restore();
 				bender.sinon.restore();
 			} );
 			} );
 		}
 		}

+ 1 - 1
src/plugin.js

@@ -19,7 +19,7 @@ define( 'plugin', [ 'plugin-core' ], function( CorePlugin ) {
 	// http://requirejs.org/docs/plugins.html#apiload
 	// http://requirejs.org/docs/plugins.html#apiload
 	CorePlugin.load = function( name, require, onload ) {
 	CorePlugin.load = function( name, require, onload ) {
 		// We may have a path to plugin modules (e.g. test/somemodule). Here we break the path on slashes.
 		// We may have a path to plugin modules (e.g. test/somemodule). Here we break the path on slashes.
-		var path = name.split( '/' );
+		let path = name.split( '/' );
 
 
 		// Inject the /src/ part right after the plugin name (e.g test/src).
 		// Inject the /src/ part right after the plugin name (e.g test/src).
 		path.splice( 1, 0, 'src' );
 		path.splice( 1, 0, 'src' );

+ 3 - 3
tests/bender/createsinonsandbox.js

@@ -5,11 +5,11 @@
 
 
 'use strict';
 'use strict';
 
 
-var obj = {
+const obj = {
 	method() {}
 	method() {}
 };
 };
-var spy;
-var origMethod = obj.method;
+const origMethod = obj.method;
+let spy;
 
 
 bender.tools.createSinonSandbox();
 bender.tools.createSinonSandbox();
 
 

+ 4 - 4
tests/ckeditor/basepath.js

@@ -55,7 +55,7 @@ describe( 'This browser', function() {
 		it( 'should not keep script URLs absolute or relative - ' + url, function() {
 		it( 'should not keep script URLs absolute or relative - ' + url, function() {
 			removeScripts();
 			removeScripts();
 
 
-			var script = addScript( url );
+			const script = addScript( url );
 
 
 			// Test if the src now contains '://'.
 			// Test if the src now contains '://'.
 			expect( script.src ).to.match( /:\/\// );
 			expect( script.src ).to.match( /:\/\// );
@@ -64,7 +64,7 @@ describe( 'This browser', function() {
 } );
 } );
 
 
 function addScript( url ) {
 function addScript( url ) {
-	var script = document.createElement( 'script' );
+	const script = document.createElement( 'script' );
 
 
 	script.src = url;
 	script.src = url;
 	document.head.appendChild( script );
 	document.head.appendChild( script );
@@ -73,8 +73,8 @@ function addScript( url ) {
 }
 }
 
 
 function removeScripts() {
 function removeScripts() {
-	var scripts = [].slice.call( document.getElementsByTagName( 'script' ) );
-	var script;
+	const scripts = [].slice.call( document.getElementsByTagName( 'script' ) );
+	let script;
 
 
 	while ( ( script = scripts.shift() ) ) {
 	while ( ( script = scripts.shift() ) ) {
 		script.parentNode.removeChild( script );
 		script.parentNode.removeChild( script );

+ 6 - 6
tests/ckeditor/ckeditor.js

@@ -11,8 +11,8 @@ describe( 'getPluginPath()', function() {
 	it( 'should return a proper path', function() {
 	it( 'should return a proper path', function() {
 		const CKEDITOR = modules.ckeditor;
 		const CKEDITOR = modules.ckeditor;
 
 
-		var basePath = CKEDITOR.basePath;
-		var path = CKEDITOR.getPluginPath( 'test' );
+		const basePath = CKEDITOR.basePath;
+		const path = CKEDITOR.getPluginPath( 'test' );
 
 
 		if ( CKEDITOR.isDev ) {
 		if ( CKEDITOR.isDev ) {
 			expect( path ).to.equal( basePath + 'node_modules/ckeditor-plugin-test/src/' );
 			expect( path ).to.equal( basePath + 'node_modules/ckeditor-plugin-test/src/' );
@@ -23,16 +23,16 @@ describe( 'getPluginPath()', function() {
 
 
 	it( '(the production version) should work even when in dev', function() {
 	it( '(the production version) should work even when in dev', function() {
 		const CKEDITOR = modules.ckeditor;
 		const CKEDITOR = modules.ckeditor;
-		var core = modules[ 'ckeditor-core' ];
+		const core = modules[ 'ckeditor-core' ];
 
 
 		// To be able to run this test on both dev and production code, we need to override getPluginPath with the
 		// To be able to run this test on both dev and production code, we need to override getPluginPath with the
 		// core version of it and restore it after testing.
 		// core version of it and restore it after testing.
-		var originalGetPluginPath = CKEDITOR.getPluginPath;
+		const originalGetPluginPath = CKEDITOR.getPluginPath;
 		CKEDITOR.getPluginPath = core.getPluginPath;
 		CKEDITOR.getPluginPath = core.getPluginPath;
 
 
 		// This test is good for both the development and production codes.
 		// This test is good for both the development and production codes.
-		var basePath = CKEDITOR.basePath;
-		var path = CKEDITOR.getPluginPath( 'test' );
+		const basePath = CKEDITOR.basePath;
+		const path = CKEDITOR.getPluginPath( 'test' );
 
 
 		// Revert the override before assertions or it will not do it in case of errors.
 		// Revert the override before assertions or it will not do it in case of errors.
 		CKEDITOR.getPluginPath = originalGetPluginPath;
 		CKEDITOR.getPluginPath = originalGetPluginPath;

+ 4 - 4
tests/plugin/plugin.js

@@ -9,23 +9,23 @@ describe( 'CKEDITOR.require()', function() {
 	it( 'should load a CKEditor plugin', function( done ) {
 	it( 'should load a CKEditor plugin', function( done ) {
 		CKEDITOR.require( [ 'plugin!devtest' ], function( DevTest ) {
 		CKEDITOR.require( [ 'plugin!devtest' ], function( DevTest ) {
 			expect( DevTest ).to.have.property( 'isDevTest' );
 			expect( DevTest ).to.have.property( 'isDevTest' );
-			done() ;
+			done();
 		} );
 		} );
 	} );
 	} );
 
 
 	it( 'should load dependencies on CKEditor plugins', function( done ) {
 	it( 'should load dependencies on CKEditor plugins', function( done ) {
 		CKEDITOR.require( [ 'plugin!devtest/someclass' ], function( SomeClass ) {
 		CKEDITOR.require( [ 'plugin!devtest/someclass' ], function( SomeClass ) {
 			expect( SomeClass ).to.have.property( 'isSomeClass' );
 			expect( SomeClass ).to.have.property( 'isSomeClass' );
-			done() ;
+			done();
 		} );
 		} );
 	} );
 	} );
 
 
 	it( 'should load a dependency into a CKEditor plugin', function( done ) {
 	it( 'should load a dependency into a CKEditor plugin', function( done ) {
 		CKEDITOR.require( [ 'plugin!devtest', 'plugin!devtest/someclass' ], function( DevTest, SomeClass ) {
 		CKEDITOR.require( [ 'plugin!devtest', 'plugin!devtest/someclass' ], function( DevTest, SomeClass ) {
-			var test = new DevTest();
+			const test = new DevTest();
 
 
 			expect( test ).to.have.property( 'someProperty' ).to.be.an.instanceof( SomeClass );
 			expect( test ).to.have.property( 'someProperty' ).to.be.an.instanceof( SomeClass );
-			done() ;
+			done();
 		} );
 		} );
 	} );
 	} );
 } );
 } );