Kaynağa Gözat

Tests: Use const for classes.

Piotrek Koszuliński 10 yıl önce
ebeveyn
işleme
0cb38cff40
39 değiştirilmiş dosya ile 114 ekleme ve 114 silme
  1. 1 1
      packages/ckeditor5-engine/src/ckeditor.js
  2. 1 1
      packages/ckeditor5-engine/src/document/operation/insertoperation.js
  3. 1 1
      packages/ckeditor5-engine/src/document/operation/reinsertoperation.js
  4. 1 1
      packages/ckeditor5-engine/src/document/operation/removeoperation.js
  5. 3 3
      packages/ckeditor5-engine/src/document/positioniterator.js
  6. 1 1
      packages/ckeditor5-engine/src/emittermixin.js
  7. 1 1
      packages/ckeditor5-engine/src/ui/domemittermixin.js
  8. 8 8
      packages/ckeditor5-engine/tests/bender/tools.js
  9. 12 12
      packages/ckeditor5-engine/tests/ckeditor/ckeditor.js
  10. 5 5
      packages/ckeditor5-engine/tests/ckeditorerror/ckeditorerror.js
  11. 1 1
      packages/ckeditor5-engine/tests/collection/collection.js
  12. 6 6
      packages/ckeditor5-engine/tests/config/config.js
  13. 1 1
      packages/ckeditor5-engine/tests/document/attribute.js
  14. 1 1
      packages/ckeditor5-engine/tests/document/character.js
  15. 1 1
      packages/ckeditor5-engine/tests/document/document.js
  16. 1 1
      packages/ckeditor5-engine/tests/document/element.js
  17. 1 1
      packages/ckeditor5-engine/tests/document/node.js
  18. 1 1
      packages/ckeditor5-engine/tests/document/nodelist.js
  19. 1 1
      packages/ckeditor5-engine/tests/document/operation/changeoperation.js
  20. 1 1
      packages/ckeditor5-engine/tests/document/operation/insertoperation.js
  21. 1 1
      packages/ckeditor5-engine/tests/document/operation/moveoperation.js
  22. 1 1
      packages/ckeditor5-engine/tests/document/operation/reinsertoperation.js
  23. 1 1
      packages/ckeditor5-engine/tests/document/operation/removeoperation.js
  24. 1 1
      packages/ckeditor5-engine/tests/document/position.js
  25. 2 2
      packages/ckeditor5-engine/tests/document/positioniterator.js
  26. 1 1
      packages/ckeditor5-engine/tests/document/range.js
  27. 1 1
      packages/ckeditor5-engine/tests/document/rootelement.js
  28. 2 2
      packages/ckeditor5-engine/tests/document/text.js
  29. 4 4
      packages/ckeditor5-engine/tests/editor/creator.js
  30. 8 8
      packages/ckeditor5-engine/tests/editor/editor.js
  31. 2 2
      packages/ckeditor5-engine/tests/editorconfig/editorconfig.js
  32. 3 3
      packages/ckeditor5-engine/tests/emittermixin/emittermixin.js
  33. 3 3
      packages/ckeditor5-engine/tests/eventinfo/eventinfo.js
  34. 7 7
      packages/ckeditor5-engine/tests/mvc/model/model.js
  35. 2 2
      packages/ckeditor5-engine/tests/plugin/plugin.js
  36. 18 18
      packages/ckeditor5-engine/tests/plugincollection/plugincollection.js
  37. 4 4
      packages/ckeditor5-engine/tests/ui/region.js
  38. 1 1
      packages/ckeditor5-engine/tests/ui/template.js
  39. 3 3
      packages/ckeditor5-engine/tests/ui/view.js

+ 1 - 1
packages/ckeditor5-engine/src/ckeditor.js

@@ -13,7 +13,7 @@
  */
 
 CKEDITOR.define( [ 'editor', 'collection', 'config' ], function( Editor, Collection, Config ) {
-	var CKEDITOR = {
+	const CKEDITOR = {
 		/**
 		 * A collection containing all editor instances created.
 		 *

+ 1 - 1
packages/ckeditor5-engine/src/document/operation/insertoperation.js

@@ -51,7 +51,7 @@ CKEDITOR.define( [
 
 		getReversed() {
 			// Because of circular dependencies we need to re-require remove operation here.
-			var RemoveOperation = CKEDITOR.require( 'document/operation/removeoperation' );
+			const RemoveOperation = CKEDITOR.require( 'document/operation/removeoperation' );
 
 			return new RemoveOperation( this.position, this.nodeList.length, this.baseVersion + 1 );
 		}

+ 1 - 1
packages/ckeditor5-engine/src/document/operation/reinsertoperation.js

@@ -23,7 +23,7 @@ CKEDITOR.define( [
 	class ReinsertOperation extends MoveOperation {
 		getReversed() {
 			// Because of circular dependencies we need to re-require reinsert operation here.
-			var RemoveOperation = CKEDITOR.require( 'document/operation/removeoperation' );
+			const RemoveOperation = CKEDITOR.require( 'document/operation/removeoperation' );
 
 			return new RemoveOperation( this.targetPosition, this.howMany, this.baseVersion + 1 );
 		}

+ 1 - 1
packages/ckeditor5-engine/src/document/operation/removeoperation.js

@@ -35,7 +35,7 @@ CKEDITOR.define( [
 
 		getReversed() {
 			// Because of circular dependencies we need to re-require reinsert operation here.
-			var ReinsertOperation = CKEDITOR.require( 'document/operation/reinsertoperation' );
+			const ReinsertOperation = CKEDITOR.require( 'document/operation/reinsertoperation' );
 
 			return new ReinsertOperation( this.targetPosition, this.sourcePosition, this.howMany, this.baseVersion + 1 );
 		}

+ 3 - 3
packages/ckeditor5-engine/src/document/positioniterator.js

@@ -10,9 +10,9 @@ CKEDITOR.define( [
 	'document/element',
 	'document/position'
 ], function( Character, Element, Position ) {
-	var ELEMENT_ENTER = 0;
-	var ELEMENT_LEAVE = 1;
-	var CHARACTER = 2;
+	const ELEMENT_ENTER = 0;
+	const ELEMENT_LEAVE = 1;
+	const CHARACTER = 2;
 
 	/**
 	 * Position iterator class. It allows to iterate forward and backward over the tree document.

+ 1 - 1
packages/ckeditor5-engine/src/emittermixin.js

@@ -13,7 +13,7 @@
  */
 
 CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
-	var EmitterMixin = {
+	const EmitterMixin = {
 		/**
 		 * Registers a callback function to be executed when an event is fired.
 		 *

+ 1 - 1
packages/ckeditor5-engine/src/ui/domemittermixin.js

@@ -37,7 +37,7 @@
  */
 
 CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, utils, log ) {
-	var DOMEmitterMixin = {
+	const DOMEmitterMixin = {
 		/**
 		 * Registers a callback function to be executed when an event is fired in a specific Emitter or DOM Node.
 		 * It is backwards compatible with {@link EmitterMixin#listenTo}.

+ 8 - 8
packages/ckeditor5-engine/tests/bender/tools.js

@@ -26,10 +26,10 @@ const modules = bender.amd.require( 'creator', 'plugin!creator-test1', 'plugin!c
 
 describe( 'bender.tools.core.defineEditorCreatorMock()', function() {
 	it( 'should register all creators', function() {
-		var Creator = modules.creator;
-		var TestCreator1 = modules[ 'plugin!creator-test1' ];
-		var TestCreator2 = modules[ 'plugin!creator-test2' ];
-		var TestCreator3 = modules[ 'plugin!creator-test3' ];
+		const Creator = modules.creator;
+		const TestCreator1 = modules[ 'plugin!creator-test1' ];
+		const TestCreator2 = modules[ 'plugin!creator-test2' ];
+		const TestCreator3 = modules[ 'plugin!creator-test3' ];
 
 		expect( TestCreator1.prototype ).to.be.instanceof( Creator );
 		expect( TestCreator2.prototype ).to.be.instanceof( Creator );
@@ -37,16 +37,16 @@ describe( 'bender.tools.core.defineEditorCreatorMock()', function() {
 	} );
 
 	it( 'should copy properties from the second argument', function() {
-		var TestCreator = modules[ 'plugin!creator-test2' ];
+		const TestCreator = modules[ 'plugin!creator-test2' ];
 
 		expect( TestCreator.prototype ).to.have.property( 'foo', 1 );
 		expect( TestCreator.prototype ).to.have.property( 'bar', 2 );
 	} );
 
 	it( 'should create spies for create() and destroy() if not defined', function() {
-		var TestCreator1 = modules[ 'plugin!creator-test1' ];
-		var TestCreator2 = modules[ 'plugin!creator-test2' ];
-		var TestCreator3 = modules[ 'plugin!creator-test3' ];
+		const TestCreator1 = modules[ 'plugin!creator-test1' ];
+		const TestCreator2 = modules[ 'plugin!creator-test2' ];
+		const TestCreator3 = modules[ 'plugin!creator-test3' ];
 
 		expect( TestCreator1.prototype.create ).to.have.property( 'called', false, 'test1.create' );
 		expect( TestCreator1.prototype.destroy ).to.have.property( 'called', false, 'test1.destroy' );

+ 12 - 12
packages/ckeditor5-engine/tests/ckeditor/ckeditor.js

@@ -16,7 +16,7 @@ bender.tools.createSinonSandbox();
 bender.tools.core.defineEditorCreatorMock( 'test' );
 
 beforeEach( function() {
-	var CKEDITOR = modules.ckeditor;
+	const CKEDITOR = modules.ckeditor;
 
 	// Destroy all editor instances.
 	while ( CKEDITOR.instances.length ) {
@@ -26,14 +26,14 @@ beforeEach( function() {
 
 describe( 'create', function() {
 	it( 'should return a promise', function() {
-		var CKEDITOR = modules.ckeditor;
+		const CKEDITOR = modules.ckeditor;
 
 		expect( CKEDITOR.create( content, editorConfig ) ).to.be.instanceof( Promise );
 	} );
 
 	it( 'should create a new editor instance', function() {
-		var CKEDITOR = modules.ckeditor;
-		var Editor = modules.editor;
+		const CKEDITOR = modules.ckeditor;
+		const Editor = modules.editor;
 
 		return CKEDITOR.create( content, editorConfig ).then( function( editor ) {
 			expect( editor ).to.be.instanceof( Editor );
@@ -42,8 +42,8 @@ describe( 'create', function() {
 	} );
 
 	it( 'should create a new editor instance (using a selector)', function() {
-		var CKEDITOR = modules.ckeditor;
-		var Editor = modules.editor;
+		const CKEDITOR = modules.ckeditor;
+		const Editor = modules.editor;
 
 		return CKEDITOR.create( '.editor', editorConfig ).then( function( editor ) {
 			expect( editor ).to.be.instanceof( Editor );
@@ -52,7 +52,7 @@ describe( 'create', function() {
 	} );
 
 	it( 'should set configurations on the new editor', function() {
-		var CKEDITOR = modules.ckeditor;
+		const CKEDITOR = modules.ckeditor;
 
 		return CKEDITOR.create( content, { test: 1, plugins: 'creator-test' } ).then( function( editor ) {
 			expect( editor.config.test ).to.equal( 1 );
@@ -60,7 +60,7 @@ describe( 'create', function() {
 	} );
 
 	it( 'should add the editor to the `instances` collection', function() {
-		var CKEDITOR = modules.ckeditor;
+		const CKEDITOR = modules.ckeditor;
 
 		return CKEDITOR.create( content, editorConfig ).then( function( editor ) {
 			expect( CKEDITOR.instances ).to.have.length( 1 );
@@ -69,7 +69,7 @@ describe( 'create', function() {
 	} );
 
 	it( 'should remove the editor from the `instances` collection on `destroy` event', function() {
-		var CKEDITOR = modules.ckeditor;
+		const CKEDITOR = modules.ckeditor;
 		var editor1, editor2;
 
 		// Create the first editor.
@@ -96,7 +96,7 @@ describe( 'create', function() {
 	} );
 
 	it( 'should be rejected on element not found', function() {
-		var CKEDITOR = modules.ckeditor;
+		const CKEDITOR = modules.ckeditor;
 
 		var addSpy = bender.sinon.spy( CKEDITOR.instances, 'add' );
 
@@ -114,8 +114,8 @@ describe( 'create', function() {
 
 describe( 'config', function() {
 	it( 'should be an instance of Config', function() {
-		var CKEDITOR = modules.ckeditor;
-		var Config = modules.config;
+		const CKEDITOR = modules.ckeditor;
+		const Config = modules.config;
 
 		expect( CKEDITOR.config ).to.be.an.instanceof( Config );
 	} );

+ 5 - 5
packages/ckeditor5-engine/tests/ckeditorerror/ckeditorerror.js

@@ -9,7 +9,7 @@ const modules = bender.amd.require( 'ckeditorerror' );
 
 describe( 'CKEditorError', function() {
 	it( 'inherits from Error', function() {
-		var CKEditorError = modules.ckeditorerror;
+		const CKEditorError = modules.ckeditorerror;
 		var error = new CKEditorError( 'foo' );
 
 		expect( error ).to.be.an.instanceOf( Error );
@@ -17,14 +17,14 @@ describe( 'CKEditorError', function() {
 	} );
 
 	it( 'sets the name', function() {
-		var CKEditorError = modules.ckeditorerror;
+		const CKEditorError = modules.ckeditorerror;
 		var error = new CKEditorError( 'foo' );
 
 		expect( error ).to.have.property( 'name', 'CKEditorError' );
 	} );
 
 	it( 'sets the message', function() {
-		var CKEditorError = modules.ckeditorerror;
+		const CKEditorError = modules.ckeditorerror;
 		var error = new CKEditorError( 'foo' );
 
 		expect( error ).to.have.property( 'message', 'foo' );
@@ -32,7 +32,7 @@ describe( 'CKEditorError', function() {
 	} );
 
 	it( 'sets the message and data', function() {
-		var CKEditorError = modules.ckeditorerror;
+		const CKEditorError = modules.ckeditorerror;
 		var data = { bar: 1 };
 		var error = new CKEditorError( 'foo', data );
 
@@ -47,7 +47,7 @@ describe( 'CKEditorError', function() {
 			}
 		}
 
-		var CKEditorError = modules.ckeditorerror;
+		const CKEditorError = modules.ckeditorerror;
 		var data = {
 			bar: 'a',
 			bom: new Foo(),

+ 1 - 1
packages/ckeditor5-engine/tests/collection/collection.js

@@ -16,7 +16,7 @@ function getItem( id, idProperty ) {
 }
 
 describe( 'Collection', () => {
-	var Collection, CKEditorError;
+	let Collection, CKEditorError;
 
 	before( () => {
 		Collection = modules.collection;

+ 6 - 6
packages/ckeditor5-engine/tests/config/config.js

@@ -10,7 +10,7 @@ const modules = bender.amd.require( 'config' );
 var config;
 
 beforeEach( function() {
-	var Config = modules.config;
+	const Config = modules.config;
 
 	config = new Config( {
 		creator: 'inline',
@@ -38,7 +38,7 @@ describe( 'constructor', function() {
 	} );
 
 	it( 'should work with no parameters', function() {
-		var Config = modules.config;
+		const Config = modules.config;
 
 		// No error should be thrown.
 		config = new Config();
@@ -47,7 +47,7 @@ describe( 'constructor', function() {
 
 describe( 'set', function() {
 	it( 'should create Config instances for objects', function() {
-		var Config = modules.config;
+		const Config = modules.config;
 
 		expect( config.resize ).to.be.an.instanceof( Config );
 		expect( config.resize.icon ).to.be.an.instanceof( Config );
@@ -112,7 +112,7 @@ describe( 'set', function() {
 	} );
 
 	it( 'should replace a simple entry with a Config instance', function() {
-		var Config = modules.config;
+		const Config = modules.config;
 
 		config.set( 'test', 1 );
 		config.set( 'test', {
@@ -124,7 +124,7 @@ describe( 'set', function() {
 	} );
 
 	it( 'should replace a simple entry with a Config instance when passing an object', function() {
-		var Config = modules.config;
+		const Config = modules.config;
 
 		config.set( 'test', 1 );
 		config.set( {
@@ -138,7 +138,7 @@ describe( 'set', function() {
 	} );
 
 	it( 'should replace a simple entry with a Config instance when passing a name.with.deep', function() {
-		var Config = modules.config;
+		const Config = modules.config;
 
 		config.set( 'test.prop', 1 );
 		config.set( 'test.prop.value', 1 );

+ 1 - 1
packages/ckeditor5-engine/tests/document/attribute.js

@@ -10,7 +10,7 @@
 const modules = bender.amd.require( 'document/attribute' );
 
 describe( 'Attribute', function() {
-	var Attribute;
+	let Attribute;
 
 	before( function() {
 		Attribute = modules[ 'document/attribute' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/character.js

@@ -17,7 +17,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'Character', function() {
-	var Element, Character, Node, Attribute;
+	let Element, Character, Node, Attribute;
 
 	before( function() {
 		Element = modules[ 'document/element' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/document.js

@@ -14,7 +14,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'Document', function() {
-	var Document, RootElement, CKEditorError;
+	let Document, RootElement, CKEditorError;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/element.js

@@ -17,7 +17,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'Element', function() {
-	var Element, Node, NodeList, Attribute;
+	let Element, Node, NodeList, Attribute;
 
 	before( function() {
 		Element = modules[ 'document/element' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/node.js

@@ -16,7 +16,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'Node', function() {
-	var Element, Character, Attribute, NodeList, CKEditorError;
+	let Element, Character, Attribute, NodeList, CKEditorError;
 
 	var root;
 	var one, two, three;

+ 1 - 1
packages/ckeditor5-engine/tests/document/nodelist.js

@@ -15,7 +15,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'NodeList', function() {
-	var NodeList, Character, Text, Attribute;
+	let NodeList, Character, Text, Attribute;
 
 	before( function() {
 		NodeList = modules[ 'document/nodelist' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/operation/changeoperation.js

@@ -20,7 +20,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'ChangeOperation', function() {
-	var Document, ChangeOperation, Position, Range, Character, Attribute, NodeList, Text, CKEditorError;
+	let Document, ChangeOperation, Position, Range, Character, Attribute, NodeList, Text, CKEditorError;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/operation/insertoperation.js

@@ -17,7 +17,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'InsertOperation', function() {
-	var Document, InsertOperation, RemoveOperation, Position, Character;
+	let Document, InsertOperation, RemoveOperation, Position, Character;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/operation/moveoperation.js

@@ -17,7 +17,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'MoveOperation', function() {
-	var Document, MoveOperation, Position, Element, NodeList, CKEditorError;
+	let Document, MoveOperation, Position, Element, NodeList, CKEditorError;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/operation/reinsertoperation.js

@@ -16,7 +16,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'ReinsertOperation', function() {
-	var Document, ReinsertOperation, RemoveOperation, MoveOperation, Position;
+	let Document, ReinsertOperation, RemoveOperation, MoveOperation, Position;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/operation/removeoperation.js

@@ -16,7 +16,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'RemoveOperation', function() {
-	var Document, ReinsertOperation, RemoveOperation, MoveOperation, Position;
+	let Document, ReinsertOperation, RemoveOperation, MoveOperation, Position;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/position.js

@@ -17,7 +17,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'position', function() {
-	var Element, Character, Document, NodeList, Position, CKEditorError;
+	let Element, Character, Document, NodeList, Position, CKEditorError;
 
 	var doc, root, p, ul, li1, li2, f, o, z, b, a, r;
 

+ 2 - 2
packages/ckeditor5-engine/tests/document/positioniterator.js

@@ -17,10 +17,10 @@ const modules = bender.amd.require(
 );
 
 describe( 'range iterator', function() {
-	var Document, Element, Character, PositionIterator, Position, Range;
+	let Document, Element, Character, PositionIterator, Position, Range;
+	let ELEMENT_ENTER, ELEMENT_LEAVE, CHARACTER;
 
 	var doc, expectedItems, root, img1, paragraph, b, a, r, img2, x;
-	var ELEMENT_ENTER, ELEMENT_LEAVE, CHARACTER;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/range.js

@@ -13,7 +13,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'Range', function() {
-	var Range, Position, start, end;
+	let Range, Position, start, end;
 
 	before( function() {
 		Position = modules[ 'document/position' ];

+ 1 - 1
packages/ckeditor5-engine/tests/document/rootelement.js

@@ -16,7 +16,7 @@ const modules = bender.amd.require(
 );
 
 describe( 'Element', function() {
-	var Document, Element, RootElement;
+	let Document, Element, RootElement;
 
 	before( function() {
 		Document = modules[ 'document/document' ];

+ 2 - 2
packages/ckeditor5-engine/tests/document/text.js

@@ -17,8 +17,8 @@ const modules = bender.amd.require(
 describe( 'Text', function() {
 	describe( 'constructor', function() {
 		it( 'should create character without attributes', function() {
-			var Text = modules[ 'document/text' ];
-			var Attribute = modules[ 'document/attribute' ];
+			const Text = modules[ 'document/text' ];
+			const Attribute = modules[ 'document/attribute' ];
 
 			var attrs = [ new Attribute( 'bold', true ) ];
 			var text = new Text( 'bar', attrs );

+ 4 - 4
packages/ckeditor5-engine/tests/editor/creator.js

@@ -11,7 +11,7 @@ const modules = bender.amd.require( 'editor', 'plugin', 'creator', 'ckeditorerro
 var editor, element;
 
 function initEditor( config ) {
-	var Editor = modules.editor;
+	const Editor = modules.editor;
 
 	element = document.createElement( 'div' );
 	document.body.appendChild( element );
@@ -69,7 +69,7 @@ afterEach( function() {
 
 describe( 'init', function() {
 	it( 'should instantiate the creator and call create()', function() {
-		var Creator = modules.creator;
+		const Creator = modules.creator;
 
 		return initEditor( {
 				plugins: 'creator-test1'
@@ -111,7 +111,7 @@ describe( 'init', function() {
 	} );
 
 	it( 'should throw an error if the creator doesn\'t exist', function() {
-		var CKEditorError = modules.ckeditorerror;
+		const CKEditorError = modules.ckeditorerror;
 
 		return initEditor( {
 				creator: 'bad',
@@ -127,7 +127,7 @@ describe( 'init', function() {
 	} );
 
 	it( 'should throw an error no creators are defined', function() {
-		var CKEditorError = modules.ckeditorerror;
+		const CKEditorError = modules.ckeditorerror;
 
 		return initEditor( {} )
 			.then( function() {

+ 8 - 8
packages/ckeditor5-engine/tests/editor/editor.js

@@ -14,7 +14,7 @@ var element;
 var asyncSpy;
 
 beforeEach( function() {
-	var Editor = modules.editor;
+	const Editor = modules.editor;
 
 	element = document.createElement( 'div' );
 	document.body.appendChild( element );
@@ -78,7 +78,7 @@ describe( 'constructor', function() {
 
 describe( 'config', function() {
 	it( 'should be an instance of EditorConfig', function() {
-		var EditorConfig = modules.editorconfig;
+		const EditorConfig = modules.editorconfig;
 
 		expect( editor.config ).to.be.an.instanceof( EditorConfig );
 	} );
@@ -86,7 +86,7 @@ describe( 'config', function() {
 
 describe( 'init', function() {
 	it( 'should return a promise that resolves properly', function() {
-		var Editor = modules.editor;
+		const Editor = modules.editor;
 
 		editor = new Editor( element, {
 			plugins: 'creator-test'
@@ -100,8 +100,8 @@ describe( 'init', function() {
 	} );
 
 	it( 'should fill `plugins`', function() {
-		var Editor = modules.editor;
-		var Plugin = modules.plugin;
+		const Editor = modules.editor;
+		const Plugin = modules.plugin;
 
 		editor = new Editor( element, {
 			plugins: 'A,B,creator-test'
@@ -119,7 +119,7 @@ describe( 'init', function() {
 	} );
 
 	it( 'should initialize plugins in the right order', function() {
-		var Editor = modules.editor;
+		const Editor = modules.editor;
 
 		editor = new Editor( element, {
 			plugins: 'creator-test,A,D'
@@ -137,7 +137,7 @@ describe( 'init', function() {
 	} );
 
 	it( 'should initialize plugins in the right order, waiting for asynchronous ones', function() {
-		var Editor = modules.editor;
+		const Editor = modules.editor;
 
 		editor = new Editor( element, {
 			plugins: 'creator-test,A,F'
@@ -156,7 +156,7 @@ describe( 'init', function() {
 	} );
 
 	it( 'should not fail if loading a plugin that doesn\'t define init()', function() {
-		var Editor = modules.editor;
+		const Editor = modules.editor;
 
 		editor = new Editor( element, {
 			plugins: 'E,creator-test'

+ 2 - 2
packages/ckeditor5-engine/tests/editorconfig/editorconfig.js

@@ -10,7 +10,7 @@ const modules = bender.amd.require( 'editorconfig', 'ckeditor' );
 var config;
 
 beforeEach( function() {
-	var EditorConfig = modules.editorconfig;
+	const EditorConfig = modules.editorconfig;
 
 	config = new EditorConfig( {
 		test: 1
@@ -29,7 +29,7 @@ describe( 'get', function() {
 	} );
 
 	it( 'should fallback to CKEDITOR.config', function() {
-		var CKEDITOR = modules.ckeditor;
+		const CKEDITOR = modules.ckeditor;
 
 		CKEDITOR.config.set( {
 			globalConfig: 2

+ 3 - 3
packages/ckeditor5-engine/tests/emittermixin/emittermixin.js

@@ -45,7 +45,7 @@ describe( 'fire', function() {
 	} );
 
 	it( 'should pass arguments to callbacks', function() {
-		var EventInfo = modules.eventinfo;
+		const EventInfo = modules.eventinfo;
 
 		var spy1 = sinon.spy();
 		var spy2 = sinon.spy();
@@ -212,7 +212,7 @@ describe( 'once', function() {
 	} );
 
 	it( 'should have proper arguments', function() {
-		var EventInfo = modules.eventinfo;
+		const EventInfo = modules.eventinfo;
 
 		var spy = sinon.spy();
 
@@ -419,7 +419,7 @@ function refreshListener() {
 }
 
 function getEmitterInstance() {
-	var EmitterMixin = modules.emittermixin;
+	const EmitterMixin = modules.emittermixin;
 	var utils = modules.utils;
 
 	return utils.extend( {}, EmitterMixin );

+ 3 - 3
packages/ckeditor5-engine/tests/eventinfo/eventinfo.js

@@ -9,7 +9,7 @@ const modules = bender.amd.require( 'eventinfo' );
 
 describe( 'EventInfo', function() {
 	it( 'should be created properly', function() {
-		var EventInfo = modules.eventinfo;
+		const EventInfo = modules.eventinfo;
 
 		var event = new EventInfo( this, 'test' );
 
@@ -20,7 +20,7 @@ describe( 'EventInfo', function() {
 	} );
 
 	it( 'should have stop() and off() marked', function() {
-		var EventInfo = modules.eventinfo;
+		const EventInfo = modules.eventinfo;
 
 		var event = new EventInfo( this, 'test' );
 
@@ -32,7 +32,7 @@ describe( 'EventInfo', function() {
 	} );
 
 	it( 'should not mark "called" in future instances', function() {
-		var EventInfo = modules.eventinfo;
+		const EventInfo = modules.eventinfo;
 
 		var event = new EventInfo( this, 'test' );
 

+ 7 - 7
packages/ckeditor5-engine/tests/mvc/model/model.js

@@ -7,11 +7,11 @@
 
 const modules = bender.amd.require( 'model', 'eventinfo', 'ckeditorerror' );
 
-var Car, car;
+let Car, car;
 
 describe( 'Model', function() {
 	beforeEach( 'Create a test model instance', function() {
-		var Model = modules.model;
+		const Model = modules.model;
 
 		Car = class extends Model {};
 
@@ -81,7 +81,7 @@ describe( 'Model', function() {
 		} );
 
 		it( 'should fire the "change" event', function() {
-			var EventInfo = modules.eventinfo;
+			const EventInfo = modules.eventinfo;
 
 			var spy = sinon.spy();
 			var spyColor = sinon.spy();
@@ -136,7 +136,7 @@ describe( 'Model', function() {
 		} );
 
 		it( 'should throw when overriding already existing property', function() {
-			var CKEditorError = modules.ckeditorerror;
+			const CKEditorError = modules.ckeditorerror;
 
 			car.normalProperty = 1;
 
@@ -148,8 +148,8 @@ describe( 'Model', function() {
 		} );
 
 		it( 'should throw when overriding already existing property (in the prototype)', function() {
-			var CKEditorError = modules.ckeditorerror;
-			var Model = modules.model;
+			const CKEditorError = modules.ckeditorerror;
+			const Model = modules.model;
 
 			class Car extends Model {
 				method() {}
@@ -167,7 +167,7 @@ describe( 'Model', function() {
 
 	describe( 'extend', function() {
 		it( 'should create new Model based classes', function() {
-			var Model = modules.model;
+			const Model = modules.model;
 
 			class Truck extends Car {}
 

+ 2 - 2
packages/ckeditor5-engine/tests/plugin/plugin.js

@@ -9,14 +9,14 @@ const modules = bender.amd.require( 'plugin', 'editor' );
 var editor;
 
 before( function() {
-	var Editor = modules.editor;
+	const Editor = modules.editor;
 
 	editor = new Editor( document.body.appendChild( document.createElement( 'div' ) ) );
 } );
 
 describe( 'constructor', function() {
 	it( 'should set the `editor` property', function() {
-		var Plugin = modules.plugin;
+		const Plugin = modules.plugin;
 
 		var plugin = new Plugin( editor );
 

+ 18 - 18
packages/ckeditor5-engine/tests/plugincollection/plugincollection.js

@@ -7,14 +7,14 @@
 
 const modules = bender.amd.require( 'plugincollection', 'plugin', 'editor', 'log' );
 var editor;
-var PluginA, PluginB;
+let PluginA, PluginB;
 class TestError extends Error {}
 
 bender.tools.createSinonSandbox();
 
 before( function() {
-	var Editor = modules.editor;
-	var Plugin = modules.plugin;
+	const Editor = modules.editor;
+	const Plugin = modules.plugin;
 
 	PluginA = class extends Plugin {};
 	PluginB = class extends Plugin {};
@@ -87,7 +87,7 @@ CKEDITOR.define( 'plugin!J', function() {
 
 describe( 'load', function() {
 	it( 'should not fail when trying to load 0 plugins (empty string)', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 
@@ -98,7 +98,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should not fail when trying to load 0 plugins (undefined)', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 
@@ -109,7 +109,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should add collection items for loaded plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 
@@ -123,7 +123,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should load dependency plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 		var spy = sinon.spy( plugins, 'add' );
@@ -138,7 +138,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should be ok when dependencies are loaded first', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 		var spy = sinon.spy( plugins, 'add' );
@@ -153,7 +153,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should load deep dependency plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 		var spy = sinon.spy( plugins, 'add' );
@@ -169,7 +169,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should handle cross dependency plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 		var spy = sinon.spy( plugins, 'add' );
@@ -185,7 +185,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should set the `editor` property on loaded plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 
@@ -197,7 +197,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should set the `path` property on loaded plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 
@@ -209,7 +209,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should set the `deps` property on loaded plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 
@@ -223,7 +223,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should reject on invalid plugin names (forward require.js loading error)', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 		var log = modules.log;
 
 		var logSpy = bender.sinon.stub( log, 'error' );
@@ -246,7 +246,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should reject on broken plugins (forward the error thrown in a plugin)', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 		var log = modules.log;
 
 		var logSpy = bender.sinon.stub( log, 'error' );
@@ -268,7 +268,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should load `deps` which are not plugins', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 
 		var plugins = new PluginCollection( editor );
 		expect( spies ).to.be.empty;
@@ -292,7 +292,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should load instances of Plugin only', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 		var plugins = new PluginCollection( editor );
 
 		return plugins.load( 'I' )
@@ -305,7 +305,7 @@ describe( 'load', function() {
 	} );
 
 	it( 'should cancel loading module which looks like a plugin but is a normal module', function() {
-		var PluginCollection = modules.plugincollection;
+		const PluginCollection = modules.plugincollection;
 		var plugins = new PluginCollection( editor );
 
 		return plugins.load( 'J' )

+ 4 - 4
packages/ckeditor5-engine/tests/ui/region.js

@@ -12,7 +12,7 @@ const modules = bender.amd.require( 'ckeditor', 'ui/region', 'ui/view', 'collect
 
 bender.tools.createSinonSandbox();
 
-var TestViewA, TestViewB;
+let TestViewA, TestViewB;
 var region, el;
 
 beforeEach( createRegionInstance );
@@ -26,7 +26,7 @@ describe( 'constructor', function() {
 
 describe( 'views collection', function() {
 	it( 'is an instance of Collection', function() {
-		var Collection = modules.collection;
+		const Collection = modules.collection;
 		expect( region.views ).to.be.an.instanceof( Collection );
 	} );
 
@@ -90,8 +90,8 @@ describe( 'destroy', function() {
 } );
 
 function createRegionInstance() {
-	var Region = modules[ 'ui/region' ];
-	var View = modules[ 'ui/view' ];
+	const Region = modules[ 'ui/region' ];
+	const View = modules[ 'ui/view' ];
 
 	class A extends View {
 		constructor() {

+ 1 - 1
packages/ckeditor5-engine/tests/ui/template.js

@@ -9,7 +9,7 @@
 'use strict';
 
 const modules = bender.amd.require( 'ckeditor', 'ui/view', 'ui/template' );
-var Template;
+let Template;
 
 bender.tools.createSinonSandbox();
 beforeEach( createClassReferences );

+ 3 - 3
packages/ckeditor5-engine/tests/ui/view.js

@@ -9,7 +9,7 @@
 'use strict';
 
 const modules = bender.amd.require( 'ckeditor', 'ui/view', 'ui/region', 'ckeditorerror', 'model', 'eventinfo' );
-var View, TestView;
+let View, TestView;
 var view;
 
 bender.tools.createSinonSandbox();
@@ -419,7 +419,7 @@ describe( 'destroy', function() {
 	} );
 
 	it( 'destroys child regions', function() {
-		var Region = modules[ 'ui/region' ];
+		const Region = modules[ 'ui/region' ];
 		var region = new Region( 'test' );
 		var spy = bender.sinon.spy( region, 'destroy' );
 
@@ -486,7 +486,7 @@ function setTestViewInstance( model ) {
 
 function dispatchEvent( el, domEvtName ) {
 	if ( !el.parentNode ) {
-		throw( 'To dispatch an event, element must be in DOM. Otherwise #target is null.' );
+		throw new Error( 'To dispatch an event, element must be in DOM. Otherwise #target is null.' );
 	}
 
 	el.dispatchEvent( new Event( domEvtName, {