瀏覽代碼

Tests: Replaced remaining var with let.

Piotrek Koszuliński 10 年之前
父節點
當前提交
912c4c8e73
共有 28 個文件被更改,包括 374 次插入374 次删除
  1. 1 1
      packages/ckeditor5-utils/tests/_tools/tools.js
  2. 2 2
      packages/ckeditor5-utils/tests/bender/tools.js
  3. 4 4
      packages/ckeditor5-utils/tests/ckeditor/ckeditor.js
  4. 7 7
      packages/ckeditor5-utils/tests/ckeditorerror/ckeditorerror.js
  5. 50 50
      packages/ckeditor5-utils/tests/collection/collection.js
  6. 3 3
      packages/ckeditor5-utils/tests/config/config.js
  7. 13 13
      packages/ckeditor5-utils/tests/document/attribute.js
  8. 5 5
      packages/ckeditor5-utils/tests/document/character.js
  9. 8 8
      packages/ckeditor5-utils/tests/document/document.js
  10. 17 17
      packages/ckeditor5-utils/tests/document/element.js
  11. 31 31
      packages/ckeditor5-utils/tests/document/node.js
  12. 12 12
      packages/ckeditor5-utils/tests/document/nodelist.js
  13. 34 34
      packages/ckeditor5-utils/tests/document/operation/changeoperation.js
  14. 8 8
      packages/ckeditor5-utils/tests/document/operation/insertoperation.js
  15. 18 18
      packages/ckeditor5-utils/tests/document/operation/moveoperation.js
  16. 3 3
      packages/ckeditor5-utils/tests/document/operation/reinsertoperation.js
  17. 11 11
      packages/ckeditor5-utils/tests/document/operation/removeoperation.js
  18. 7 7
      packages/ckeditor5-utils/tests/document/position.js
  19. 18 18
      packages/ckeditor5-utils/tests/document/positioniterator.js
  20. 11 11
      packages/ckeditor5-utils/tests/document/range.js
  21. 2 2
      packages/ckeditor5-utils/tests/document/rootelement.js
  22. 2 2
      packages/ckeditor5-utils/tests/document/text.js
  23. 59 59
      packages/ckeditor5-utils/tests/emittermixin/emittermixin.js
  24. 3 3
      packages/ckeditor5-utils/tests/eventinfo/eventinfo.js
  25. 7 7
      packages/ckeditor5-utils/tests/log/log.js
  26. 8 8
      packages/ckeditor5-utils/tests/mvc/model/model.js
  27. 2 2
      packages/ckeditor5-utils/tests/plugin/plugin.js
  28. 28 28
      packages/ckeditor5-utils/tests/utils/utils.js

+ 1 - 1
packages/ckeditor5-utils/tests/_tools/tools.js

@@ -32,7 +32,7 @@
 				class TestCreator extends Creator {}
 				class TestCreator extends Creator {}
 
 
 				if ( proto ) {
 				if ( proto ) {
-					for ( var propName in proto ) {
+					for ( let propName in proto ) {
 						TestCreator.prototype[ propName ] = proto[ propName ];
 						TestCreator.prototype[ propName ] = proto[ propName ];
 					}
 					}
 				}
 				}

+ 2 - 2
packages/ckeditor5-utils/tests/bender/tools.js

@@ -7,8 +7,8 @@
 
 
 'use strict';
 'use strict';
 
 
-var createFn3 = function() {};
-var destroyFn3 = function() {};
+let createFn3 = function() {};
+let destroyFn3 = function() {};
 
 
 bender.tools.core.defineEditorCreatorMock( 'test1' );
 bender.tools.core.defineEditorCreatorMock( 'test1' );
 bender.tools.core.defineEditorCreatorMock( 'test2', {
 bender.tools.core.defineEditorCreatorMock( 'test2', {

+ 4 - 4
packages/ckeditor5-utils/tests/ckeditor/ckeditor.js

@@ -9,8 +9,8 @@
 
 
 const modules = bender.amd.require( 'ckeditor', 'editor', 'config' );
 const modules = bender.amd.require( 'ckeditor', 'editor', 'config' );
 
 
-var content = document.getElementById( 'content' );
-var editorConfig = { plugins: 'creator-test' };
+let content = document.getElementById( 'content' );
+let editorConfig = { plugins: 'creator-test' };
 
 
 bender.tools.createSinonSandbox();
 bender.tools.createSinonSandbox();
 bender.tools.core.defineEditorCreatorMock( 'test' );
 bender.tools.core.defineEditorCreatorMock( 'test' );
@@ -70,7 +70,7 @@ describe( 'create', function() {
 
 
 	it( 'should remove the editor from the `instances` collection on `destroy` event', function() {
 	it( 'should remove the editor from the `instances` collection on `destroy` event', function() {
 		const CKEDITOR = modules.ckeditor;
 		const CKEDITOR = modules.ckeditor;
-		var editor1, editor2;
+		let editor1, editor2;
 
 
 		// Create the first editor.
 		// Create the first editor.
 		return CKEDITOR.create( content, editorConfig ).then( function( editor ) {
 		return CKEDITOR.create( content, editorConfig ).then( function( editor ) {
@@ -98,7 +98,7 @@ describe( 'create', function() {
 	it( 'should be rejected on element not found', function() {
 	it( 'should be rejected on element not found', function() {
 		const CKEDITOR = modules.ckeditor;
 		const CKEDITOR = modules.ckeditor;
 
 
-		var addSpy = bender.sinon.spy( CKEDITOR.instances, 'add' );
+		let addSpy = bender.sinon.spy( CKEDITOR.instances, 'add' );
 
 
 		return CKEDITOR.create( '.undefined' ).then( function() {
 		return CKEDITOR.create( '.undefined' ).then( function() {
 			throw new Error( 'It should not enter this function' );
 			throw new Error( 'It should not enter this function' );

+ 7 - 7
packages/ckeditor5-utils/tests/ckeditorerror/ckeditorerror.js

@@ -10,7 +10,7 @@ const modules = bender.amd.require( 'ckeditorerror' );
 describe( 'CKEditorError', function() {
 describe( 'CKEditorError', function() {
 	it( 'inherits from Error', function() {
 	it( 'inherits from Error', function() {
 		const CKEditorError = modules.ckeditorerror;
 		const CKEditorError = modules.ckeditorerror;
-		var error = new CKEditorError( 'foo' );
+		let error = new CKEditorError( 'foo' );
 
 
 		expect( error ).to.be.an.instanceOf( Error );
 		expect( error ).to.be.an.instanceOf( Error );
 		expect( error ).to.be.an.instanceOf( CKEditorError );
 		expect( error ).to.be.an.instanceOf( CKEditorError );
@@ -18,14 +18,14 @@ describe( 'CKEditorError', function() {
 
 
 	it( 'sets the name', function() {
 	it( 'sets the name', function() {
 		const CKEditorError = modules.ckeditorerror;
 		const CKEditorError = modules.ckeditorerror;
-		var error = new CKEditorError( 'foo' );
+		let error = new CKEditorError( 'foo' );
 
 
 		expect( error ).to.have.property( 'name', 'CKEditorError' );
 		expect( error ).to.have.property( 'name', 'CKEditorError' );
 	} );
 	} );
 
 
 	it( 'sets the message', function() {
 	it( 'sets the message', function() {
 		const CKEditorError = modules.ckeditorerror;
 		const CKEditorError = modules.ckeditorerror;
-		var error = new CKEditorError( 'foo' );
+		let error = new CKEditorError( 'foo' );
 
 
 		expect( error ).to.have.property( 'message', 'foo' );
 		expect( error ).to.have.property( 'message', 'foo' );
 		expect( error.data ).to.be.undefined;
 		expect( error.data ).to.be.undefined;
@@ -33,8 +33,8 @@ describe( 'CKEditorError', function() {
 
 
 	it( 'sets the message and data', function() {
 	it( 'sets the message and data', function() {
 		const CKEditorError = modules.ckeditorerror;
 		const CKEditorError = modules.ckeditorerror;
-		var data = { bar: 1 };
-		var error = new CKEditorError( 'foo', data );
+		let data = { bar: 1 };
+		let error = new CKEditorError( 'foo', data );
 
 
 		expect( error ).to.have.property( 'message', 'foo {"bar":1}' );
 		expect( error ).to.have.property( 'message', 'foo {"bar":1}' );
 		expect( error ).to.have.property( 'data', data );
 		expect( error ).to.have.property( 'data', data );
@@ -48,12 +48,12 @@ describe( 'CKEditorError', function() {
 		}
 		}
 
 
 		const CKEditorError = modules.ckeditorerror;
 		const CKEditorError = modules.ckeditorerror;
-		var data = {
+		let data = {
 			bar: 'a',
 			bar: 'a',
 			bom: new Foo(),
 			bom: new Foo(),
 			bim: document.body
 			bim: document.body
 		};
 		};
-		var error = new CKEditorError( 'foo', data );
+		let error = new CKEditorError( 'foo', data );
 
 
 		expect( error ).to.have.property( 'message', 'foo {"bar":"a","bom":{"x":1},"bim":{}}' );
 		expect( error ).to.have.property( 'message', 'foo {"bar":"a","bom":{"x":1},"bim":{}}' );
 		expect( error ).to.have.property( 'data', data );
 		expect( error ).to.have.property( 'data', data );

+ 50 - 50
packages/ckeditor5-utils/tests/collection/collection.js

@@ -23,7 +23,7 @@ describe( 'Collection', () => {
 		CKEditorError = modules.CKEditorError;
 		CKEditorError = modules.CKEditorError;
 	} );
 	} );
 
 
-	var collection;
+	let collection;
 
 
 	beforeEach( () => {
 	beforeEach( () => {
 		collection = new Collection();
 		collection = new Collection();
@@ -31,9 +31,9 @@ describe( 'Collection', () => {
 
 
 	describe( 'constructor', () => {
 	describe( 'constructor', () => {
 		it( 'allows to change the id property used by the collection', () => {
 		it( 'allows to change the id property used by the collection', () => {
-			var item1 = { id: 'foo', name: 'xx' };
-			var item2 = { id: 'foo', name: 'yy' };
-			var collection = new Collection( { idProperty: 'name' } );
+			let item1 = { id: 'foo', name: 'xx' };
+			let item2 = { id: 'foo', name: 'yy' };
+			let collection = new Collection( { idProperty: 'name' } );
 
 
 			collection.add( item1 );
 			collection.add( item1 );
 			collection.add( item2 );
 			collection.add( item2 );
@@ -61,8 +61,8 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should enable get( index )', () => {
 		it( 'should enable get( index )', () => {
-			var item1 = {};
-			var item2 = {};
+			let item1 = {};
+			let item2 = {};
 
 
 			collection.add( item1 );
 			collection.add( item1 );
 			expect( collection.get( 0 ) ).to.equal( item1 );
 			expect( collection.get( 0 ) ).to.equal( item1 );
@@ -73,8 +73,8 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should enable get( id )', () => {
 		it( 'should enable get( id )', () => {
-			var item1 = getItem( 'foo' );
-			var item2 = getItem( 'bar' );
+			let item1 = getItem( 'foo' );
+			let item2 = getItem( 'bar' );
 
 
 			collection.add( item1 );
 			collection.add( item1 );
 			collection.add( item2 );
 			collection.add( item2 );
@@ -84,9 +84,9 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should enable get( id ) - custom id property', () => {
 		it( 'should enable get( id ) - custom id property', () => {
-			var collection = new Collection( { idProperty: 'name' } );
-			var item1 = getItem( 'foo', 'name' );
-			var item2 = getItem( 'bar', 'name' );
+			let collection = new Collection( { idProperty: 'name' } );
+			let item1 = getItem( 'foo', 'name' );
+			let item2 = getItem( 'bar', 'name' );
 
 
 			collection.add( item1 );
 			collection.add( item1 );
 			collection.add( item2 );
 			collection.add( item2 );
@@ -96,7 +96,7 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should generate an id when not defined', () => {
 		it( 'should generate an id when not defined', () => {
-			var item = {};
+			let item = {};
 
 
 			collection.add( item );
 			collection.add( item );
 
 
@@ -105,8 +105,8 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should generate an id when not defined - custom id property', () => {
 		it( 'should generate an id when not defined - custom id property', () => {
-			var collection = new Collection( { idProperty: 'name' } );
-			var item = {};
+			let collection = new Collection( { idProperty: 'name' } );
+			let item = {};
 
 
 			collection.add( item );
 			collection.add( item );
 
 
@@ -115,7 +115,7 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should not change an existing id of an item', () => {
 		it( 'should not change an existing id of an item', () => {
-			var item = getItem( 'foo' );
+			let item = getItem( 'foo' );
 
 
 			collection.add( item );
 			collection.add( item );
 
 
@@ -123,8 +123,8 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should throw when item with this id already exists', () => {
 		it( 'should throw when item with this id already exists', () => {
-			var item1 = getItem( 'foo' );
-			var item2 = getItem( 'foo' );
+			let item1 = getItem( 'foo' );
+			let item2 = getItem( 'foo' );
 
 
 			collection.add( item1 );
 			collection.add( item1 );
 
 
@@ -134,7 +134,7 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should throw when item\'s id is not a string', () => {
 		it( 'should throw when item\'s id is not a string', () => {
-			var item = { id: 1 };
+			let item = { id: 1 };
 
 
 			expect( () => {
 			expect( () => {
 				collection.add( item );
 				collection.add( item );
@@ -149,7 +149,7 @@ describe( 'Collection', () => {
 				collection.add( getItem( '1' ) );
 				collection.add( getItem( '1' ) );
 				collection.add( getItem( '2' ) );
 				collection.add( getItem( '2' ) );
 
 
-				var item = {};
+				let item = {};
 
 
 				collection.add( item );
 				collection.add( item );
 
 
@@ -158,8 +158,8 @@ describe( 'Collection', () => {
 		);
 		);
 
 
 		it( 'should fire the "add" event', () => {
 		it( 'should fire the "add" event', () => {
-			var spy = sinon.spy();
-			var item = {};
+			let spy = sinon.spy();
+			let item = {};
 
 
 			collection.on( 'add', spy );
 			collection.on( 'add', spy );
 
 
@@ -171,7 +171,7 @@ describe( 'Collection', () => {
 
 
 	describe( 'get', () => {
 	describe( 'get', () => {
 		it( 'should return an item', () => {
 		it( 'should return an item', () => {
-			var item = getItem( 'foo' );
+			let item = getItem( 'foo' );
 			collection.add( item );
 			collection.add( item );
 
 
 			expect( collection.get( 'foo' ) ).to.equal( item );
 			expect( collection.get( 'foo' ) ).to.equal( item );
@@ -198,7 +198,7 @@ describe( 'Collection', () => {
 
 
 			expect( collection ).to.have.length( 3 );
 			expect( collection ).to.have.length( 3 );
 
 
-			var removedItem = collection.remove( 1 );
+			let removedItem = collection.remove( 1 );
 
 
 			expect( collection ).to.have.length( 2 );
 			expect( collection ).to.have.length( 2 );
 			expect( collection.get( 'foo' ) ).to.be.null;
 			expect( collection.get( 'foo' ) ).to.be.null;
@@ -207,11 +207,11 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should remove the model by index - custom id property', () => {
 		it( 'should remove the model by index - custom id property', () => {
-			var collection = new Collection( { idProperty: 'name' } );
+			let collection = new Collection( { idProperty: 'name' } );
 
 
 			collection.add( getItem( 'foo', 'name' ) );
 			collection.add( getItem( 'foo', 'name' ) );
 
 
-			var removedItem = collection.remove( 0 );
+			let removedItem = collection.remove( 0 );
 
 
 			expect( collection ).to.have.length( 0 );
 			expect( collection ).to.have.length( 0 );
 			expect( collection.get( 'foo' ) ).to.be.null;
 			expect( collection.get( 'foo' ) ).to.be.null;
@@ -225,7 +225,7 @@ describe( 'Collection', () => {
 
 
 			expect( collection ).to.have.length( 3 );
 			expect( collection ).to.have.length( 3 );
 
 
-			var removedItem = collection.remove( 'foo' );
+			let removedItem = collection.remove( 'foo' );
 
 
 			expect( collection ).to.have.length( 2 );
 			expect( collection ).to.have.length( 2 );
 			expect( collection.get( 'foo' ) ).to.be.null;
 			expect( collection.get( 'foo' ) ).to.be.null;
@@ -234,7 +234,7 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should remove the model by model', () => {
 		it( 'should remove the model by model', () => {
-			var item = getItem( 'foo' );
+			let item = getItem( 'foo' );
 
 
 			collection.add( getItem( 'bom' ) );
 			collection.add( getItem( 'bom' ) );
 			collection.add( item );
 			collection.add( item );
@@ -242,7 +242,7 @@ describe( 'Collection', () => {
 
 
 			expect( collection ).to.have.length( 3 );
 			expect( collection ).to.have.length( 3 );
 
 
-			var removedItem = collection.remove( item );
+			let removedItem = collection.remove( item );
 
 
 			expect( collection ).to.have.length( 2 );
 			expect( collection ).to.have.length( 2 );
 			expect( collection.get( 'foo' ) ).to.be.null;
 			expect( collection.get( 'foo' ) ).to.be.null;
@@ -251,12 +251,12 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should remove the model by model - custom id property', () => {
 		it( 'should remove the model by model - custom id property', () => {
-			var collection = new Collection( null, 'name' );
-			var item = getItem( 'foo', 'name' );
+			let collection = new Collection( null, 'name' );
+			let item = getItem( 'foo', 'name' );
 
 
 			collection.add( item );
 			collection.add( item );
 
 
-			var removedItem = collection.remove( item );
+			let removedItem = collection.remove( item );
 
 
 			expect( collection ).to.have.length( 0 );
 			expect( collection ).to.have.length( 0 );
 			expect( collection.get( 'foo' ) ).to.be.null;
 			expect( collection.get( 'foo' ) ).to.be.null;
@@ -264,15 +264,15 @@ describe( 'Collection', () => {
 		} );
 		} );
 
 
 		it( 'should fire the "remove" event', () => {
 		it( 'should fire the "remove" event', () => {
-			var item1 = getItem( 'foo' );
-			var item2 = getItem( 'bar' );
-			var item3 = getItem( 'bom' );
+			let item1 = getItem( 'foo' );
+			let item2 = getItem( 'bar' );
+			let item3 = getItem( 'bom' );
 
 
 			collection.add( item1 );
 			collection.add( item1 );
 			collection.add( item2 );
 			collection.add( item2 );
 			collection.add( item3 );
 			collection.add( item3 );
 
 
-			var spy = sinon.spy();
+			let spy = sinon.spy();
 
 
 			collection.on( 'remove', spy );
 			collection.on( 'remove', spy );
 
 
@@ -319,12 +319,12 @@ describe( 'Collection', () => {
 
 
 	describe( 'map', () => {
 	describe( 'map', () => {
 		it( 'uses native map', () => {
 		it( 'uses native map', () => {
-			var spy = bender.sinon.stub( Array.prototype, 'map', () => {
+			let spy = bender.sinon.stub( Array.prototype, 'map', () => {
 				return [ 'foo' ];
 				return [ 'foo' ];
 			} );
 			} );
-			var ctx = {};
+			let ctx = {};
 
 
-			var ret = collection.map( callback, ctx );
+			let ret = collection.map( callback, ctx );
 
 
 			sinon.assert.calledWithExactly( spy, callback, ctx );
 			sinon.assert.calledWithExactly( spy, callback, ctx );
 			expect( ret ).to.deep.equal( [ 'foo' ], 'ret value was forwarded' );
 			expect( ret ).to.deep.equal( [ 'foo' ], 'ret value was forwarded' );
@@ -335,14 +335,14 @@ describe( 'Collection', () => {
 
 
 	describe( 'find', () => {
 	describe( 'find', () => {
 		it( 'uses native find', () => {
 		it( 'uses native find', () => {
-			var needl = getItem( 'foo' );
+			let needl = getItem( 'foo' );
 
 
-			var spy = bender.sinon.stub( Array.prototype, 'find', () => {
+			let spy = bender.sinon.stub( Array.prototype, 'find', () => {
 				return needl;
 				return needl;
 			} );
 			} );
-			var ctx = {};
+			let ctx = {};
 
 
-			var ret = collection.find( callback, ctx );
+			let ret = collection.find( callback, ctx );
 
 
 			sinon.assert.calledWithExactly( spy, callback, ctx );
 			sinon.assert.calledWithExactly( spy, callback, ctx );
 			expect( ret ).to.equal( needl, 'ret value was forwarded' );
 			expect( ret ).to.equal( needl, 'ret value was forwarded' );
@@ -353,14 +353,14 @@ describe( 'Collection', () => {
 
 
 	describe( 'filter', () => {
 	describe( 'filter', () => {
 		it( 'uses native filter', () => {
 		it( 'uses native filter', () => {
-			var needl = getItem( 'foo' );
+			let needl = getItem( 'foo' );
 
 
-			var spy = bender.sinon.stub( Array.prototype, 'filter', () => {
+			let spy = bender.sinon.stub( Array.prototype, 'filter', () => {
 				return [ needl ];
 				return [ needl ];
 			} );
 			} );
-			var ctx = {};
+			let ctx = {};
 
 
-			var ret = collection.filter( callback, ctx );
+			let ret = collection.filter( callback, ctx );
 
 
 			sinon.assert.calledWithExactly( spy, callback, ctx );
 			sinon.assert.calledWithExactly( spy, callback, ctx );
 			expect( ret ).to.deep.equal( [ needl ], 'ret value was forwarded' );
 			expect( ret ).to.deep.equal( [ needl ], 'ret value was forwarded' );
@@ -371,10 +371,10 @@ describe( 'Collection', () => {
 
 
 	describe( 'iterator', () => {
 	describe( 'iterator', () => {
 		it( 'covers the whole collection', () => {
 		it( 'covers the whole collection', () => {
-			var item1 = getItem( 'foo' );
-			var item2 = getItem( 'bar' );
-			var item3 = getItem( 'bom' );
-			var items = [];
+			let item1 = getItem( 'foo' );
+			let item2 = getItem( 'bar' );
+			let item3 = getItem( 'bom' );
+			let items = [];
 
 
 			collection.add( item1 );
 			collection.add( item1 );
 			collection.add( item2 );
 			collection.add( item2 );

+ 3 - 3
packages/ckeditor5-utils/tests/config/config.js

@@ -7,7 +7,7 @@
 
 
 const modules = bender.amd.require( 'config' );
 const modules = bender.amd.require( 'config' );
 
 
-var config;
+let config;
 
 
 beforeEach( function() {
 beforeEach( function() {
 	const Config = modules.config;
 	const Config = modules.config;
@@ -179,13 +179,13 @@ describe( 'get', function() {
 	} );
 	} );
 
 
 	it( 'should retrieve a subset of the configuration', function() {
 	it( 'should retrieve a subset of the configuration', function() {
-		var resizeConfig = config.get( 'resize' );
+		let resizeConfig = config.get( 'resize' );
 
 
 		expect( resizeConfig ).to.have.property( 'minheight' ).to.equal( 300 );
 		expect( resizeConfig ).to.have.property( 'minheight' ).to.equal( 300 );
 		expect( resizeConfig ).to.have.property( 'maxheight' ).to.equal( 800 );
 		expect( resizeConfig ).to.have.property( 'maxheight' ).to.equal( 800 );
 		expect( resizeConfig ).to.have.property( 'icon' ).to.have.property( 'path' ).to.equal( 'xyz' );
 		expect( resizeConfig ).to.have.property( 'icon' ).to.have.property( 'path' ).to.equal( 'xyz' );
 
 
-		var iconConfig = resizeConfig.get( 'icon' );
+		let iconConfig = resizeConfig.get( 'icon' );
 
 
 		expect( iconConfig ).to.have.property( 'path' ).to.equal( 'xyz' );
 		expect( iconConfig ).to.have.property( 'path' ).to.equal( 'xyz' );
 	} );
 	} );

+ 13 - 13
packages/ckeditor5-utils/tests/document/attribute.js

@@ -22,15 +22,15 @@ describe( 'Attribute', function() {
 
 
 	describe( 'constructor', function() {
 	describe( 'constructor', function() {
 		it( 'should create attribute', function() {
 		it( 'should create attribute', function() {
-			var attr = new Attribute( 'foo', 'bar' );
+			let attr = new Attribute( 'foo', 'bar' );
 
 
 			expect( attr ).to.have.property( 'key' ).that.equals( 'foo' );
 			expect( attr ).to.have.property( 'key' ).that.equals( 'foo' );
 			expect( attr ).to.have.property( 'value' ).that.equals( 'bar' );
 			expect( attr ).to.have.property( 'value' ).that.equals( 'bar' );
 		} );
 		} );
 
 
 		it( 'should create equal instance even if object has different order', function() {
 		it( 'should create equal instance even if object has different order', function() {
-			var attr1 = new Attribute( 'foo', { a: 1, b: 2 } );
-			var attr2 = new Attribute( 'foo', { b: 2, a: 1 } );
+			let attr1 = new Attribute( 'foo', { a: 1, b: 2 } );
+			let attr2 = new Attribute( 'foo', { b: 2, a: 1 } );
 
 
 			expect( attr1.isEqual( attr2 ) ).to.be.true;
 			expect( attr1.isEqual( attr2 ) ).to.be.true;
 		} );
 		} );
@@ -38,8 +38,8 @@ describe( 'Attribute', function() {
 		it( 'should return the same object for registered objects', function() {
 		it( 'should return the same object for registered objects', function() {
 			Attribute.register( 'register', true );
 			Attribute.register( 'register', true );
 
 
-			var attr1 = new Attribute( 'register', true );
-			var attr2 = new Attribute( 'register', true );
+			let attr1 = new Attribute( 'register', true );
+			let attr2 = new Attribute( 'register', true );
 
 
 			expect( attr1 ).to.equal( attr2 );
 			expect( attr1 ).to.equal( attr2 );
 			expect( attr1.isEqual( attr2 ) ).to.be.true;
 			expect( attr1.isEqual( attr2 ) ).to.be.true;
@@ -48,8 +48,8 @@ describe( 'Attribute', function() {
 		it( 'should return different objects for different values', function() {
 		it( 'should return different objects for different values', function() {
 			Attribute.register( 'register', true );
 			Attribute.register( 'register', true );
 
 
-			var attr1 = new Attribute( 'register', true );
-			var attr2 = new Attribute( 'register', false );
+			let attr1 = new Attribute( 'register', true );
+			let attr2 = new Attribute( 'register', false );
 
 
 			expect( attr1 ).to.not.be.equals( attr2 );
 			expect( attr1 ).to.not.be.equals( attr2 );
 			expect( attr1.isEqual( attr2 ) ).to.not.be.true;
 			expect( attr1.isEqual( attr2 ) ).to.not.be.true;
@@ -58,8 +58,8 @@ describe( 'Attribute', function() {
 		it( 'should return different objects for not registered objects', function() {
 		it( 'should return different objects for not registered objects', function() {
 			Attribute.register( 'register', true );
 			Attribute.register( 'register', true );
 
 
-			var attr1 = new Attribute( 'register', false );
-			var attr2 = new Attribute( 'register', false );
+			let attr1 = new Attribute( 'register', false );
+			let attr2 = new Attribute( 'register', false );
 
 
 			expect( attr1 ).to.not.be.equals( attr2 );
 			expect( attr1 ).to.not.be.equals( attr2 );
 			expect( attr1.isEqual( attr2 ) ).to.be.true;
 			expect( attr1.isEqual( attr2 ) ).to.be.true;
@@ -68,10 +68,10 @@ describe( 'Attribute', function() {
 
 
 	describe( 'register', function() {
 	describe( 'register', function() {
 		it( 'Attribute.register should return registered attribute', function() {
 		it( 'Attribute.register should return registered attribute', function() {
-			var attr1 = new Attribute( 'register', true );
-			var attr2 = Attribute.register( 'register', true );
-			var attr3 = Attribute.register( 'register', true );
-			var attr4 = new Attribute( 'register', true );
+			let attr1 = new Attribute( 'register', true );
+			let attr2 = Attribute.register( 'register', true );
+			let attr3 = Attribute.register( 'register', true );
+			let attr4 = new Attribute( 'register', true );
 
 
 			expect( attr1 ).to.not.be.equals( attr2 );
 			expect( attr1 ).to.not.be.equals( attr2 );
 			expect( attr2 ).to.equal( attr3 );
 			expect( attr2 ).to.equal( attr3 );

+ 5 - 5
packages/ckeditor5-utils/tests/document/character.js

@@ -28,8 +28,8 @@ describe( 'Character', function() {
 
 
 	describe( 'constructor', function() {
 	describe( 'constructor', function() {
 		it( 'should create character without attributes', function() {
 		it( 'should create character without attributes', function() {
-			var character = new Character( 'f' );
-			var parent = new Element( 'parent', [], character );
+			let character = new Character( 'f' );
+			let parent = new Element( 'parent', [], character );
 
 
 			expect( character ).to.be.an.instanceof( Node );
 			expect( character ).to.be.an.instanceof( Node );
 			expect( character ).to.have.property( 'character' ).that.equals( 'f' );
 			expect( character ).to.have.property( 'character' ).that.equals( 'f' );
@@ -38,9 +38,9 @@ describe( 'Character', function() {
 		} );
 		} );
 
 
 		it( 'should create character with attributes', function() {
 		it( 'should create character with attributes', function() {
-			var attr = new Attribute( 'foo', 'bar' );
-			var character = new Character( 'f', [ attr ] );
-			var parent = new Element( 'parent', [], character );
+			let attr = new Attribute( 'foo', 'bar' );
+			let character = new Character( 'f', [ attr ] );
+			let parent = new Element( 'parent', [], character );
 
 
 			expect( character ).to.be.an.instanceof( Node );
 			expect( character ).to.be.an.instanceof( Node );
 			expect( character ).to.have.property( 'character' ).that.equals( 'f' );
 			expect( character ).to.have.property( 'character' ).that.equals( 'f' );

+ 8 - 8
packages/ckeditor5-utils/tests/document/document.js

@@ -22,7 +22,7 @@ describe( 'Document', function() {
 		CKEditorError = modules.ckeditorerror;
 		CKEditorError = modules.ckeditorerror;
 	} );
 	} );
 
 
-	var document;
+	let document;
 
 
 	beforeEach( function() {
 	beforeEach( function() {
 		document = new Document();
 		document = new Document();
@@ -39,7 +39,7 @@ describe( 'Document', function() {
 
 
 	describe( 'createRoot', function() {
 	describe( 'createRoot', function() {
 		it( 'should create a new RootElement, add it to roots map and return it', function() {
 		it( 'should create a new RootElement, add it to roots map and return it', function() {
-			var root = document.createRoot( 'root' );
+			let root = document.createRoot( 'root' );
 
 
 			expect( document.roots.size ).to.equal( 2 );
 			expect( document.roots.size ).to.equal( 2 );
 			expect( root ).to.be.instanceof( RootElement );
 			expect( root ).to.be.instanceof( RootElement );
@@ -59,8 +59,8 @@ describe( 'Document', function() {
 
 
 	describe( 'getRoot', function() {
 	describe( 'getRoot', function() {
 		it( 'should return a RootElement previously created with given name', function() {
 		it( 'should return a RootElement previously created with given name', function() {
-			var newRoot = document.createRoot( 'root' );
-			var getRoot = document.getRoot( 'root' );
+			let newRoot = document.createRoot( 'root' );
+			let getRoot = document.getRoot( 'root' );
 
 
 			expect( getRoot ).to.equal( newRoot );
 			expect( getRoot ).to.equal( newRoot );
 		} );
 		} );
@@ -76,8 +76,8 @@ describe( 'Document', function() {
 
 
 	describe( 'applyOperation', function() {
 	describe( 'applyOperation', function() {
 		it( 'should increase document version, execute operation and fire operationApplied', function() {
 		it( 'should increase document version, execute operation and fire operationApplied', function() {
-			var operationApplied = sinon.spy();
-			var operation = {
+			let operationApplied = sinon.spy();
+			let operation = {
 				baseVersion: 0,
 				baseVersion: 0,
 				_execute: sinon.spy()
 				_execute: sinon.spy()
 			};
 			};
@@ -92,8 +92,8 @@ describe( 'Document', function() {
 		} );
 		} );
 
 
 		it( 'should throw an error on the operation base version and the document version is different', function() {
 		it( 'should throw an error on the operation base version and the document version is different', function() {
-			var operationApplied = sinon.spy();
-			var operation = {
+			let operationApplied = sinon.spy();
+			let operation = {
 				baseVersion: 1
 				baseVersion: 1
 			};
 			};
 
 

+ 17 - 17
packages/ckeditor5-utils/tests/document/element.js

@@ -28,8 +28,8 @@ describe( 'Element', function() {
 
 
 	describe( 'constructor', function() {
 	describe( 'constructor', function() {
 		it( 'should create element without attributes', function() {
 		it( 'should create element without attributes', function() {
-			var element = new Element( 'elem' );
-			var parent = new Element( 'parent', [], [ element ] );
+			let element = new Element( 'elem' );
+			let parent = new Element( 'parent', [], [ element ] );
 
 
 			expect( element ).to.be.an.instanceof( Node );
 			expect( element ).to.be.an.instanceof( Node );
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
@@ -38,10 +38,10 @@ describe( 'Element', function() {
 		} );
 		} );
 
 
 		it( 'should create element with attributes', function() {
 		it( 'should create element with attributes', function() {
-			var attr = new Attribute( 'foo', 'bar' );
+			let attr = new Attribute( 'foo', 'bar' );
 
 
-			var element = new Element( 'elem', [ attr ] );
-			var parent = new Element( 'parent', [], [ element ] );
+			let element = new Element( 'elem', [ attr ] );
+			let parent = new Element( 'parent', [], [ element ] );
 
 
 			expect( element ).to.be.an.instanceof( Node );
 			expect( element ).to.be.an.instanceof( Node );
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
@@ -51,7 +51,7 @@ describe( 'Element', function() {
 		} );
 		} );
 
 
 		it( 'should create element with children', function() {
 		it( 'should create element with children', function() {
-			var element = new Element( 'elem', [], 'foo' );
+			let element = new Element( 'elem', [], 'foo' );
 
 
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
 			expect( element.getChildCount() ).to.equal( 3 );
 			expect( element.getChildCount() ).to.equal( 3 );
@@ -63,7 +63,7 @@ describe( 'Element', function() {
 
 
 	describe( 'insertChildren', function() {
 	describe( 'insertChildren', function() {
 		it( 'should add children to the element', function() {
 		it( 'should add children to the element', function() {
-			var element = new Element( 'elem', [], [ 'xy' ] );
+			let element = new Element( 'elem', [], [ 'xy' ] );
 			element.insertChildren( 1, 'foo' );
 			element.insertChildren( 1, 'foo' );
 
 
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
 			expect( element ).to.have.property( 'name' ).that.equals( 'elem' );
@@ -78,11 +78,11 @@ describe( 'Element', function() {
 
 
 	describe( 'removeChildren', function() {
 	describe( 'removeChildren', function() {
 		it( 'should remove children from the element and return them as a NodeList', function() {
 		it( 'should remove children from the element and return them as a NodeList', function() {
-			var element = new Element( 'elem', [], [ 'foobar' ] );
-			var o = element.getChild( 2 );
-			var b = element.getChild( 3 );
-			var a = element.getChild( 4 );
-			var removed = element.removeChildren( 2, 3 );
+			let element = new Element( 'elem', [], [ 'foobar' ] );
+			let o = element.getChild( 2 );
+			let b = element.getChild( 3 );
+			let a = element.getChild( 4 );
+			let removed = element.removeChildren( 2, 3 );
 
 
 			expect( element.getChildCount() ).to.equal( 3 );
 			expect( element.getChildCount() ).to.equal( 3 );
 			expect( element.getChild( 0 ) ).to.have.property( 'character' ).that.equals( 'f' );
 			expect( element.getChild( 0 ) ).to.have.property( 'character' ).that.equals( 'f' );
@@ -103,10 +103,10 @@ describe( 'Element', function() {
 
 
 	describe( 'getChildIndex', function() {
 	describe( 'getChildIndex', function() {
 		it( 'should return child index', function() {
 		it( 'should return child index', function() {
-			var element = new Element( 'elem', [], [ 'bar' ] );
-			var b = element.getChild( 0 );
-			var a = element.getChild( 1 );
-			var r = element.getChild( 2 );
+			let element = new Element( 'elem', [], [ 'bar' ] );
+			let b = element.getChild( 0 );
+			let a = element.getChild( 1 );
+			let r = element.getChild( 2 );
 
 
 			expect( element.getChildIndex( b ) ).to.equal( 0 );
 			expect( element.getChildIndex( b ) ).to.equal( 0 );
 			expect( element.getChildIndex( a ) ).to.equal( 1 );
 			expect( element.getChildIndex( a ) ).to.equal( 1 );
@@ -116,7 +116,7 @@ describe( 'Element', function() {
 
 
 	describe( 'getChildCount', function() {
 	describe( 'getChildCount', function() {
 		it( 'should return number of children', function() {
 		it( 'should return number of children', function() {
-			var element = new Element( 'elem', [], [ 'bar' ] );
+			let element = new Element( 'elem', [], [ 'bar' ] );
 
 
 			expect( element.getChildCount() ).to.equal( 3 );
 			expect( element.getChildCount() ).to.equal( 3 );
 		} );
 		} );

+ 31 - 31
packages/ckeditor5-utils/tests/document/node.js

@@ -18,9 +18,9 @@ const modules = bender.amd.require(
 describe( 'Node', function() {
 describe( 'Node', function() {
 	let Element, Character, Attribute, NodeList, CKEditorError;
 	let Element, Character, Attribute, NodeList, CKEditorError;
 
 
-	var root;
-	var one, two, three;
-	var charB, charA, charR, img;
+	let root;
+	let one, two, three;
+	let charB, charA, charR, img;
 
 
 	before( function() {
 	before( function() {
 		Element = modules[ 'document/element' ];
 		Element = modules[ 'document/element' ];
@@ -97,9 +97,9 @@ describe( 'Node', function() {
 
 
 	describe( 'constructor', function() {
 	describe( 'constructor', function() {
 		it( 'should copy attributes, not pass by reference', function() {
 		it( 'should copy attributes, not pass by reference', function() {
-			var attrs = [ new Attribute( 'attr', true ) ];
-			var foo = new Element( 'foo', attrs );
-			var bar = new Element( 'bar', attrs );
+			let attrs = [ new Attribute( 'attr', true ) ];
+			let foo = new Element( 'foo', attrs );
+			let bar = new Element( 'bar', attrs );
 
 
 			foo.removeAttr( 'attr' );
 			foo.removeAttr( 'attr' );
 
 
@@ -109,7 +109,7 @@ describe( 'Node', function() {
 	} );
 	} );
 
 
 	describe( 'getAttr', function() {
 	describe( 'getAttr', function() {
-		var fooAttr, element;
+		let fooAttr, element;
 
 
 		beforeEach( function() {
 		beforeEach( function() {
 			fooAttr = new Attribute( 'foo', true );
 			fooAttr = new Attribute( 'foo', true );
@@ -127,8 +127,8 @@ describe( 'Node', function() {
 
 
 	describe( 'setAttr', function() {
 	describe( 'setAttr', function() {
 		it( 'should insert an attribute', function() {
 		it( 'should insert an attribute', function() {
-			var element = new Element( 'elem' );
-			var attr = new Attribute( 'foo', 'bar' );
+			let element = new Element( 'elem' );
+			let attr = new Attribute( 'foo', 'bar' );
 
 
 			element.setAttr( attr );
 			element.setAttr( attr );
 
 
@@ -137,9 +137,9 @@ describe( 'Node', function() {
 		} );
 		} );
 
 
 		it( 'should overwrite attribute with the same key', function() {
 		it( 'should overwrite attribute with the same key', function() {
-			var oldAttr = new Attribute( 'foo', 'bar' );
-			var newAttr = new Attribute( 'foo', 'bar' );
-			var element = new Element( 'elem', [ oldAttr ] );
+			let oldAttr = new Attribute( 'foo', 'bar' );
+			let newAttr = new Attribute( 'foo', 'bar' );
+			let element = new Element( 'elem', [ oldAttr ] );
 
 
 			element.setAttr( newAttr );
 			element.setAttr( newAttr );
 
 
@@ -150,10 +150,10 @@ describe( 'Node', function() {
 
 
 	describe( 'removeAttr', function() {
 	describe( 'removeAttr', function() {
 		it( 'should remove an attribute', function() {
 		it( 'should remove an attribute', function() {
-			var attrA = new Attribute( 'a', 'A' );
-			var attrB = new Attribute( 'b', 'b' );
-			var attrC = new Attribute( 'c', 'C' );
-			var element = new Element( 'elem', [ attrA, attrB, attrC ] );
+			let attrA = new Attribute( 'a', 'A' );
+			let attrB = new Attribute( 'b', 'b' );
+			let attrC = new Attribute( 'c', 'C' );
+			let element = new Element( 'elem', [ attrA, attrB, attrC ] );
 
 
 			element.removeAttr( attrB.key );
 			element.removeAttr( attrB.key );
 
 
@@ -166,40 +166,40 @@ describe( 'Node', function() {
 
 
 	describe( 'hasAttr', function() {
 	describe( 'hasAttr', function() {
 		it( 'should check attribute by key', function() {
 		it( 'should check attribute by key', function() {
-			var fooAttr = new Attribute( 'foo', true );
-			var element = new Element( 'foo', [ fooAttr ] );
+			let fooAttr = new Attribute( 'foo', true );
+			let element = new Element( 'foo', [ fooAttr ] );
 
 
 			expect( element.hasAttr( 'foo' ) ).to.be.true;
 			expect( element.hasAttr( 'foo' ) ).to.be.true;
 		} );
 		} );
 
 
 		it( 'should return false if attribute was not found by key', function() {
 		it( 'should return false if attribute was not found by key', function() {
-			var fooAttr = new Attribute( 'foo', true );
-			var element = new Element( 'foo', [ fooAttr ] );
+			let fooAttr = new Attribute( 'foo', true );
+			let element = new Element( 'foo', [ fooAttr ] );
 
 
 			expect( element.hasAttr( 'bar' ) ).to.be.false;
 			expect( element.hasAttr( 'bar' ) ).to.be.false;
 		} );
 		} );
 
 
 		it( 'should check attribute by object', function() {
 		it( 'should check attribute by object', function() {
-			var fooAttr = new Attribute( 'foo', true );
-			var foo2Attr = new Attribute( 'foo', true );
-			var element = new Element( 'foo', [ fooAttr ] );
+			let fooAttr = new Attribute( 'foo', true );
+			let foo2Attr = new Attribute( 'foo', true );
+			let element = new Element( 'foo', [ fooAttr ] );
 
 
 			expect( element.hasAttr( foo2Attr ) ).to.be.true;
 			expect( element.hasAttr( foo2Attr ) ).to.be.true;
 		} );
 		} );
 
 
 		it( 'should return false if attribute was not found by object', function() {
 		it( 'should return false if attribute was not found by object', function() {
-			var fooAttr = new Attribute( 'foo', true );
-			var element = new Element( 'foo' );
+			let fooAttr = new Attribute( 'foo', true );
+			let element = new Element( 'foo' );
 
 
 			expect( element.hasAttr( fooAttr ) ).to.be.false;
 			expect( element.hasAttr( fooAttr ) ).to.be.false;
 		} );
 		} );
 
 
 		it( 'should create proper JSON string using toJSON method', function() {
 		it( 'should create proper JSON string using toJSON method', function() {
-			var b = new Character( 'b' );
-			var foo = new Element( 'foo', [], [ b ] );
+			let b = new Character( 'b' );
+			let foo = new Element( 'foo', [], [ b ] );
 
 
-			var parsedFoo = JSON.parse( JSON.stringify( foo ) );
-			var parsedBar = JSON.parse( JSON.stringify( b ) );
+			let parsedFoo = JSON.parse( JSON.stringify( foo ) );
+			let parsedBar = JSON.parse( JSON.stringify( b ) );
 
 
 			expect( parsedFoo.parent ).to.equal( null );
 			expect( parsedFoo.parent ).to.equal( null );
 			expect( parsedBar.parent ).to.equal( 'foo' );
 			expect( parsedBar.parent ).to.equal( 'foo' );
@@ -223,8 +223,8 @@ describe( 'Node', function() {
 		} );
 		} );
 
 
 		it( 'should throw an error if parent does not contains element', function() {
 		it( 'should throw an error if parent does not contains element', function() {
-			var f = new Character( 'f' );
-			var bar = new Element( 'bar', [], [] );
+			let f = new Character( 'f' );
+			let bar = new Element( 'bar', [], [] );
 
 
 			f.parent = bar;
 			f.parent = bar;
 
 

+ 12 - 12
packages/ckeditor5-utils/tests/document/nodelist.js

@@ -26,7 +26,7 @@ describe( 'NodeList', function() {
 
 
 	describe( 'constructor', function() {
 	describe( 'constructor', function() {
 		it( 'should change array of strings into a set of nodes', function() {
 		it( 'should change array of strings into a set of nodes', function() {
-			var nodeList = new NodeList( [ 'foo', new Character( 'x' ), 'bar' ] );
+			let nodeList = new NodeList( [ 'foo', new Character( 'x' ), 'bar' ] );
 
 
 			expect( nodeList.length ).to.equal( 7 );
 			expect( nodeList.length ).to.equal( 7 );
 			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
 			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
@@ -39,7 +39,7 @@ describe( 'NodeList', function() {
 		} );
 		} );
 
 
 		it( 'should change string into a set of nodes', function() {
 		it( 'should change string into a set of nodes', function() {
-			var nodeList = new NodeList( 'foo' );
+			let nodeList = new NodeList( 'foo' );
 
 
 			expect( nodeList.length ).to.equal( 3 );
 			expect( nodeList.length ).to.equal( 3 );
 			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
 			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
@@ -48,15 +48,15 @@ describe( 'NodeList', function() {
 		} );
 		} );
 
 
 		it( 'should change node into a set of nodes', function() {
 		it( 'should change node into a set of nodes', function() {
-			var nodeList = new NodeList( new Character( 'x' ) );
+			let nodeList = new NodeList( new Character( 'x' ) );
 
 
 			expect( nodeList.length ).to.equal( 1 );
 			expect( nodeList.length ).to.equal( 1 );
 			expect( nodeList.get( 0 ).character ).to.equal( 'x' );
 			expect( nodeList.get( 0 ).character ).to.equal( 'x' );
 		} );
 		} );
 
 
 		it( 'should change text with attribute into a set of nodes', function() {
 		it( 'should change text with attribute into a set of nodes', function() {
-			var attr = new Attribute( 'bold', true );
-			var nodeList = new NodeList( new Text( 'foo', [ attr ] ) );
+			let attr = new Attribute( 'bold', true );
+			let nodeList = new NodeList( new Text( 'foo', [ attr ] ) );
 
 
 			expect( nodeList.length ).to.equal( 3 );
 			expect( nodeList.length ).to.equal( 3 );
 			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
 			expect( nodeList.get( 0 ).character ).to.equal( 'f' );
@@ -70,8 +70,8 @@ describe( 'NodeList', function() {
 
 
 	describe( 'insert', function() {
 	describe( 'insert', function() {
 		it( 'should insert one nodelist into another', function() {
 		it( 'should insert one nodelist into another', function() {
-			var outerList = new NodeList( 'foo' );
-			var innerList = new NodeList( 'xxx' );
+			let outerList = new NodeList( 'foo' );
+			let innerList = new NodeList( 'xxx' );
 
 
 			outerList.insert( 2, innerList );
 			outerList.insert( 2, innerList );
 
 
@@ -87,7 +87,7 @@ describe( 'NodeList', function() {
 
 
 	describe( 'remove', function() {
 	describe( 'remove', function() {
 		it( 'should remove part of the nodelist', function() {
 		it( 'should remove part of the nodelist', function() {
-			var nodeList = new NodeList( 'foobar' );
+			let nodeList = new NodeList( 'foobar' );
 
 
 			nodeList.remove( 2, 3 );
 			nodeList.remove( 2, 3 );
 
 
@@ -100,11 +100,11 @@ describe( 'NodeList', function() {
 
 
 	describe( 'iterator', function() {
 	describe( 'iterator', function() {
 		it( 'should iterate over all elements in the collection', function() {
 		it( 'should iterate over all elements in the collection', function() {
-			var characters = 'foo';
-			var nodeList = new NodeList( characters );
-			var i = 0;
+			let characters = 'foo';
+			let nodeList = new NodeList( characters );
+			let i = 0;
 
 
-			for ( var node of nodeList ) {
+			for ( let node of nodeList ) {
 				expect( node.character ).to.equal( characters[ i ] );
 				expect( node.character ).to.equal( characters[ i ] );
 				i++;
 				i++;
 			}
 			}

+ 34 - 34
packages/ckeditor5-utils/tests/document/operation/changeoperation.js

@@ -34,7 +34,7 @@ describe( 'ChangeOperation', function() {
 		CKEditorError = modules.ckeditorerror;
 		CKEditorError = modules.ckeditorerror;
 	} );
 	} );
 
 
-	var doc, root;
+	let doc, root;
 
 
 	beforeEach( function() {
 	beforeEach( function() {
 		doc = new Document();
 		doc = new Document();
@@ -42,7 +42,7 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should insert attribute to the set of nodes', function() {
 	it( 'should insert attribute to the set of nodes', function() {
-		var newAttr = new Attribute( 'isNew', true );
+		let newAttr = new Attribute( 'isNew', true );
 
 
 		root.insertChildren( 0, 'bar' );
 		root.insertChildren( 0, 'bar' );
 
 
@@ -63,9 +63,9 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should add attribute to the existing attributes', function() {
 	it( 'should add attribute to the existing attributes', function() {
-		var newAttr = new Attribute( 'isNew', true );
-		var fooAttr = new Attribute( 'foo', true );
-		var barAttr = new Attribute( 'bar', true );
+		let newAttr = new Attribute( 'isNew', true );
+		let fooAttr = new Attribute( 'foo', true );
+		let barAttr = new Attribute( 'bar', true );
 
 
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, barAttr ] ) );
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, barAttr ] ) );
 
 
@@ -87,8 +87,8 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should change attribute to the set of nodes', function() {
 	it( 'should change attribute to the set of nodes', function() {
-		var oldAttr = new Attribute( 'isNew', false );
-		var newAttr = new Attribute( 'isNew', true );
+		let oldAttr = new Attribute( 'isNew', false );
+		let newAttr = new Attribute( 'isNew', true );
 
 
 		root.insertChildren( 0, new Text( 'bar', [ oldAttr ] ) );
 		root.insertChildren( 0, new Text( 'bar', [ oldAttr ] ) );
 
 
@@ -112,10 +112,10 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should change attribute in the middle of existing attributes', function() {
 	it( 'should change attribute in the middle of existing attributes', function() {
-		var fooAttr = new Attribute( 'foo', true );
-		var x1Attr = new Attribute( 'x', 1 );
-		var x2Attr = new Attribute( 'x', 2 );
-		var barAttr = new Attribute( 'bar', true );
+		let fooAttr = new Attribute( 'foo', true );
+		let x1Attr = new Attribute( 'x', 1 );
+		let x2Attr = new Attribute( 'x', 2 );
+		let barAttr = new Attribute( 'bar', true );
 
 
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, x1Attr, barAttr ] ) );
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, x1Attr, barAttr ] ) );
 
 
@@ -137,9 +137,9 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should remove attribute', function() {
 	it( 'should remove attribute', function() {
-		var fooAttr = new Attribute( 'foo', true );
-		var xAttr = new Attribute( 'x', true );
-		var barAttr = new Attribute( 'bar', true );
+		let fooAttr = new Attribute( 'foo', true );
+		let xAttr = new Attribute( 'x', true );
+		let barAttr = new Attribute( 'bar', true );
 
 
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, xAttr, barAttr ] ) );
 		root.insertChildren( 0, new Character( 'x', [ fooAttr, xAttr, barAttr ] ) );
 
 
@@ -160,11 +160,11 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should create a change operation as a reverse', function() {
 	it( 'should create a change operation as a reverse', function() {
-		var oldAttr = new Attribute( 'x', 'old' );
-		var newAttr = new Attribute( 'x', 'new' );
-		var range = new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) );
-		var operation = new ChangeOperation( range, oldAttr, newAttr, doc.version );
-		var reverse = operation.getReversed();
+		let oldAttr = new Attribute( 'x', 'old' );
+		let newAttr = new Attribute( 'x', 'new' );
+		let range = new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) );
+		let operation = new ChangeOperation( range, oldAttr, newAttr, doc.version );
+		let reverse = operation.getReversed();
 
 
 		expect( reverse ).to.be.an.instanceof( ChangeOperation );
 		expect( reverse ).to.be.an.instanceof( ChangeOperation );
 		expect( reverse.baseVersion ).to.equal( 1 );
 		expect( reverse.baseVersion ).to.equal( 1 );
@@ -174,18 +174,18 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo adding attribute by applying reverse operation', function() {
 	it( 'should undo adding attribute by applying reverse operation', function() {
-		var newAttr = new Attribute( 'isNew', true );
+		let newAttr = new Attribute( 'isNew', true );
 
 
 		root.insertChildren( 0, 'bar' );
 		root.insertChildren( 0, 'bar' );
 
 
-		var operation = new ChangeOperation(
+		let operation = new ChangeOperation(
 			new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) ),
 			new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) ),
 			null,
 			null,
 			newAttr,
 			newAttr,
 			doc.version
 			doc.version
 		);
 		);
 
 
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		doc.applyOperation( operation );
 		doc.applyOperation( operation );
 		doc.applyOperation( reverse );
 		doc.applyOperation( reverse );
@@ -198,19 +198,19 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo changing attribute by applying reverse operation', function() {
 	it( 'should undo changing attribute by applying reverse operation', function() {
-		var oldAttr = new Attribute( 'isNew', false );
-		var newAttr = new Attribute( 'isNew', true );
+		let oldAttr = new Attribute( 'isNew', false );
+		let newAttr = new Attribute( 'isNew', true );
 
 
 		root.insertChildren( 0, new Text( 'bar', [ oldAttr ] ) );
 		root.insertChildren( 0, new Text( 'bar', [ oldAttr ] ) );
 
 
-		var operation = new ChangeOperation(
+		let operation = new ChangeOperation(
 			new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) ),
 			new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) ),
 			oldAttr,
 			oldAttr,
 			newAttr,
 			newAttr,
 			doc.version
 			doc.version
 		);
 		);
 
 
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		doc.applyOperation( operation );
 		doc.applyOperation( operation );
 
 
@@ -227,18 +227,18 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo remove attribute by applying reverse operation', function() {
 	it( 'should undo remove attribute by applying reverse operation', function() {
-		var fooAttr = new Attribute( 'foo', false );
+		let fooAttr = new Attribute( 'foo', false );
 
 
 		root.insertChildren( 0, new Text( 'bar', [ fooAttr ] ) );
 		root.insertChildren( 0, new Text( 'bar', [ fooAttr ] ) );
 
 
-		var operation = new ChangeOperation(
+		let operation = new ChangeOperation(
 			new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) ),
 			new Range( new Position( [ 0 ], root ), new Position( [ 3 ], root ) ),
 			fooAttr,
 			fooAttr,
 			null,
 			null,
 			doc.version
 			doc.version
 		);
 		);
 
 
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		doc.applyOperation( operation );
 		doc.applyOperation( operation );
 
 
@@ -255,7 +255,7 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should throw an error when one try to remove and the attribute does not exists', function() {
 	it( 'should throw an error when one try to remove and the attribute does not exists', function() {
-		var fooAttr = new Attribute( 'foo', true );
+		let fooAttr = new Attribute( 'foo', true );
 
 
 		root.insertChildren( 0, 'x' );
 		root.insertChildren( 0, 'x' );
 
 
@@ -274,8 +274,8 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should throw an error when one try to insert and the attribute already exists', function() {
 	it( 'should throw an error when one try to insert and the attribute already exists', function() {
-		var x1Attr = new Attribute( 'x', 1 );
-		var x2Attr = new Attribute( 'x', 2 );
+		let x1Attr = new Attribute( 'x', 1 );
+		let x2Attr = new Attribute( 'x', 2 );
 
 
 		root.insertChildren( 0, new Character( 'x', [ x1Attr ] ) );
 		root.insertChildren( 0, new Character( 'x', [ x1Attr ] ) );
 
 
@@ -294,8 +294,8 @@ describe( 'ChangeOperation', function() {
 	} );
 	} );
 
 
 	it( 'should throw an error when one try to change and the new and old attributes have different keys', function() {
 	it( 'should throw an error when one try to change and the new and old attributes have different keys', function() {
-		var fooAttr = new Attribute( 'foo', true );
-		var barAttr = new Attribute( 'bar', true );
+		let fooAttr = new Attribute( 'foo', true );
+		let barAttr = new Attribute( 'bar', true );
 
 
 		root.insertChildren( 0, 'x' );
 		root.insertChildren( 0, 'x' );
 
 

+ 8 - 8
packages/ckeditor5-utils/tests/document/operation/insertoperation.js

@@ -27,7 +27,7 @@ describe( 'InsertOperation', function() {
 		Character = modules[ 'document/character' ];
 		Character = modules[ 'document/character' ];
 	} );
 	} );
 
 
-	var doc, root;
+	let doc, root;
 
 
 	beforeEach( function() {
 	beforeEach( function() {
 		doc = new Document();
 		doc = new Document();
@@ -105,14 +105,14 @@ describe( 'InsertOperation', function() {
 	} );
 	} );
 
 
 	it( 'should create a remove operation as a reverse', function() {
 	it( 'should create a remove operation as a reverse', function() {
-		var position = new Position( [ 0 ], root );
-		var operation = new InsertOperation(
+		let position = new Position( [ 0 ], root );
+		let operation = new InsertOperation(
 			position,
 			position,
 			[ 'foo', new Character( 'x' ), 'bar' ],
 			[ 'foo', new Character( 'x' ), 'bar' ],
 			0
 			0
 		);
 		);
 
 
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		expect( reverse ).to.be.an.instanceof( RemoveOperation );
 		expect( reverse ).to.be.an.instanceof( RemoveOperation );
 		expect( reverse.baseVersion ).to.equal( 1 );
 		expect( reverse.baseVersion ).to.equal( 1 );
@@ -121,13 +121,13 @@ describe( 'InsertOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo insert node by applying reverse operation', function() {
 	it( 'should undo insert node by applying reverse operation', function() {
-		var operation = new InsertOperation(
+		let operation = new InsertOperation(
 			new Position( [ 0 ], root ),
 			new Position( [ 0 ], root ),
 			new Character( 'x' ),
 			new Character( 'x' ),
 			doc.version
 			doc.version
 		);
 		);
 
 
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		doc.applyOperation( operation );
 		doc.applyOperation( operation );
 
 
@@ -140,13 +140,13 @@ describe( 'InsertOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo insert set of nodes by applying reverse operation', function() {
 	it( 'should undo insert set of nodes by applying reverse operation', function() {
-		var operation = new InsertOperation(
+		let operation = new InsertOperation(
 			new Position( [ 0 ], root ),
 			new Position( [ 0 ], root ),
 			'bar',
 			'bar',
 			doc.version
 			doc.version
 		);
 		);
 
 
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		doc.applyOperation( operation );
 		doc.applyOperation( operation );
 
 

+ 18 - 18
packages/ckeditor5-utils/tests/document/operation/moveoperation.js

@@ -28,7 +28,7 @@ describe( 'MoveOperation', function() {
 		CKEditorError = modules.ckeditorerror;
 		CKEditorError = modules.ckeditorerror;
 	} );
 	} );
 
 
-	var doc, root;
+	let doc, root;
 
 
 	beforeEach( function() {
 	beforeEach( function() {
 		doc = new Document();
 		doc = new Document();
@@ -36,8 +36,8 @@ describe( 'MoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should move from one node to another', function() {
 	it( 'should move from one node to another', function() {
-		var p1 = new Element( 'p1', [], new Element( 'x' ) );
-		var p2 = new Element( 'p2' );
+		let p1 = new Element( 'p1', [], new Element( 'x' ) );
+		let p2 = new Element( 'p2' );
 
 
 		root.insertChildren( 0, [ p1, p2 ] );
 		root.insertChildren( 0, [ p1, p2 ] );
 
 
@@ -102,14 +102,14 @@ describe( 'MoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should create a move operation as a reverse', function() {
 	it( 'should create a move operation as a reverse', function() {
-		var nodeList = new NodeList( 'bar' );
+		let nodeList = new NodeList( 'bar' );
 
 
-		var sourcePosition = new Position( [ 0 ], root );
-		var targetPosition = new Position( [ 4 ], root );
+		let sourcePosition = new Position( [ 0 ], root );
+		let targetPosition = new Position( [ 4 ], root );
 
 
-		var operation = new MoveOperation( sourcePosition, targetPosition, nodeList.length, doc.version );
+		let operation = new MoveOperation( sourcePosition, targetPosition, nodeList.length, doc.version );
 
 
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		expect( reverse ).to.be.an.instanceof( MoveOperation );
 		expect( reverse ).to.be.an.instanceof( MoveOperation );
 		expect( reverse.baseVersion ).to.equal( 1 );
 		expect( reverse.baseVersion ).to.equal( 1 );
@@ -119,12 +119,12 @@ describe( 'MoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo move node by applying reverse operation', function() {
 	it( 'should undo move node by applying reverse operation', function() {
-		var p1 = new Element( 'p1', [], new Element( 'x' ) );
-		var p2 = new Element( 'p2' );
+		let p1 = new Element( 'p1', [], new Element( 'x' ) );
+		let p2 = new Element( 'p2' );
 
 
 		root.insertChildren( 0, [ p1, p2 ] );
 		root.insertChildren( 0, [ p1, p2 ] );
 
 
-		var operation = new MoveOperation(
+		let operation = new MoveOperation(
 			new Position( [ 0, 0 ], root ),
 			new Position( [ 0, 0 ], root ),
 			new Position( [ 1, 0 ], root ),
 			new Position( [ 1, 0 ], root ),
 			1,
 			1,
@@ -166,11 +166,11 @@ describe( 'MoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should throw an error if target or source parent-element specified by position does not exist', function() {
 	it( 'should throw an error if target or source parent-element specified by position does not exist', function() {
-		var p = new Element( 'p' );
+		let p = new Element( 'p' );
 		p.insertChildren( 0, 'foo' );
 		p.insertChildren( 0, 'foo' );
 		root.insertChildren( 0, [ 'ab', p ] );
 		root.insertChildren( 0, [ 'ab', p ] );
 
 
-		var operation = new MoveOperation(
+		let operation = new MoveOperation(
 			new Position( [ 2, 0 ], root ),
 			new Position( [ 2, 0 ], root ),
 			new Position( [ 1 ], root ),
 			new Position( [ 1 ], root ),
 			3,
 			3,
@@ -189,7 +189,7 @@ describe( 'MoveOperation', function() {
 	it( 'should throw an error if operation tries to move a range between the beginning and the end of that range', function() {
 	it( 'should throw an error if operation tries to move a range between the beginning and the end of that range', function() {
 		root.insertChildren( 0, 'xbarx' );
 		root.insertChildren( 0, 'xbarx' );
 
 
-		var operation = new MoveOperation(
+		let operation = new MoveOperation(
 			new Position( [ 1 ], root ),
 			new Position( [ 1 ], root ),
 			new Position( [ 2 ], root ),
 			new Position( [ 2 ], root ),
 			3,
 			3,
@@ -204,10 +204,10 @@ describe( 'MoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should throw an error if operation tries to move a range into a sub-tree of a node that is in that range', function() {
 	it( 'should throw an error if operation tries to move a range into a sub-tree of a node that is in that range', function() {
-		var p = new Element( 'p', [], [ new Element( 'p' ) ] );
+		let p = new Element( 'p', [], [ new Element( 'p' ) ] );
 		root.insertChildren( 0, [ 'ab', p, 'xy' ] );
 		root.insertChildren( 0, [ 'ab', p, 'xy' ] );
 
 
-		var operation = new MoveOperation(
+		let operation = new MoveOperation(
 			new Position( [ 1 ], root ),
 			new Position( [ 1 ], root ),
 			new Position( [ 2, 0, 0 ], root ),
 			new Position( [ 2, 0, 0 ], root ),
 			3,
 			3,
@@ -222,10 +222,10 @@ describe( 'MoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should not throw an error if operation move a range into a sibling', function() {
 	it( 'should not throw an error if operation move a range into a sibling', function() {
-		var p = new Element( 'p' );
+		let p = new Element( 'p' );
 		root.insertChildren( 0, [ 'ab', p, 'xy' ] );
 		root.insertChildren( 0, [ 'ab', p, 'xy' ] );
 
 
-		var operation = new MoveOperation(
+		let operation = new MoveOperation(
 			new Position( [ 1 ], root ),
 			new Position( [ 1 ], root ),
 			new Position( [ 2, 0 ], root ),
 			new Position( [ 2, 0 ], root ),
 			1,
 			1,

+ 3 - 3
packages/ckeditor5-utils/tests/document/operation/reinsertoperation.js

@@ -26,7 +26,7 @@ describe( 'ReinsertOperation', function() {
 		Position = modules[ 'document/position' ];
 		Position = modules[ 'document/position' ];
 	} );
 	} );
 
 
-	var doc, root, graveyard, operation, graveyardPosition, rootPosition;
+	let doc, root, graveyard, operation, graveyardPosition, rootPosition;
 
 
 	beforeEach( function() {
 	beforeEach( function() {
 		doc = new Document();
 		doc = new Document();
@@ -49,7 +49,7 @@ describe( 'ReinsertOperation', function() {
 	} );
 	} );
 
 
 	it( 'should create a remove operation as a reverse', function() {
 	it( 'should create a remove operation as a reverse', function() {
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		expect( reverse ).to.be.an.instanceof( RemoveOperation );
 		expect( reverse ).to.be.an.instanceof( RemoveOperation );
 		expect( reverse.baseVersion ).to.equal( 1 );
 		expect( reverse.baseVersion ).to.equal( 1 );
@@ -59,7 +59,7 @@ describe( 'ReinsertOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo reinsert set of nodes by applying reverse operation', function() {
 	it( 'should undo reinsert set of nodes by applying reverse operation', function() {
-		var reverse = operation.getReversed();
+		let reverse = operation.getReversed();
 
 
 		graveyard.insertChildren( 0, 'bar' );
 		graveyard.insertChildren( 0, 'bar' );
 
 

+ 11 - 11
packages/ckeditor5-utils/tests/document/operation/removeoperation.js

@@ -26,7 +26,7 @@ describe( 'RemoveOperation', function() {
 		Position = modules[ 'document/position' ];
 		Position = modules[ 'document/position' ];
 	} );
 	} );
 
 
-	var doc, root, graveyard;
+	let doc, root, graveyard;
 
 
 	beforeEach( function() {
 	beforeEach( function() {
 		doc = new Document();
 		doc = new Document();
@@ -35,7 +35,7 @@ describe( 'RemoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should extend MoveOperation class', function() {
 	it( 'should extend MoveOperation class', function() {
-		var operation = new RemoveOperation(
+		let operation = new RemoveOperation(
 			new Position( [ 2 ], root ),
 			new Position( [ 2 ], root ),
 			2,
 			2,
 			doc.version
 			doc.version
@@ -47,9 +47,9 @@ describe( 'RemoveOperation', function() {
 	it( 'should remove set of nodes and append them to graveyard root', function() {
 	it( 'should remove set of nodes and append them to graveyard root', function() {
 		root.insertChildren( 0, 'fozbar' );
 		root.insertChildren( 0, 'fozbar' );
 
 
-		var z = root.getChild( 2 );
-		var b = root.getChild( 3 );
-		var a = root.getChild( 4 );
+		let z = root.getChild( 2 );
+		let b = root.getChild( 3 );
+		let a = root.getChild( 4 );
 
 
 		doc.applyOperation(
 		doc.applyOperation(
 			new RemoveOperation(
 			new RemoveOperation(
@@ -69,9 +69,9 @@ describe( 'RemoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should create a reinsert operation as a reverse', function() {
 	it( 'should create a reinsert operation as a reverse', function() {
-		var position = new Position( [ 0 ], root );
-		var operation = new RemoveOperation( position, 2, 0 );
-		var reverse = operation.getReversed();
+		let position = new Position( [ 0 ], root );
+		let operation = new RemoveOperation( position, 2, 0 );
+		let reverse = operation.getReversed();
 
 
 		expect( reverse ).to.be.an.instanceof( ReinsertOperation );
 		expect( reverse ).to.be.an.instanceof( ReinsertOperation );
 		expect( reverse.baseVersion ).to.equal( 1 );
 		expect( reverse.baseVersion ).to.equal( 1 );
@@ -81,9 +81,9 @@ describe( 'RemoveOperation', function() {
 	} );
 	} );
 
 
 	it( 'should undo remove set of nodes by applying reverse operation', function() {
 	it( 'should undo remove set of nodes by applying reverse operation', function() {
-		var position = new Position( [ 0 ], root );
-		var operation = new RemoveOperation( position, 3, 0 );
-		var reverse = operation.getReversed();
+		let position = new Position( [ 0 ], root );
+		let operation = new RemoveOperation( position, 3, 0 );
+		let reverse = operation.getReversed();
 
 
 		root.insertChildren( 0, 'bar' );
 		root.insertChildren( 0, 'bar' );
 
 

+ 7 - 7
packages/ckeditor5-utils/tests/document/position.js

@@ -19,7 +19,7 @@ const modules = bender.amd.require(
 describe( 'position', function() {
 describe( 'position', function() {
 	let 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;
+	let doc, root, p, ul, li1, li2, f, o, z, b, a, r;
 
 
 	// root
 	// root
 	//  |- p         Before: [ 0 ]       After: [ 1 ]
 	//  |- p         Before: [ 0 ]       After: [ 1 ]
@@ -64,7 +64,7 @@ describe( 'position', function() {
 	} );
 	} );
 
 
 	it( 'should create a position with path and document', function() {
 	it( 'should create a position with path and document', function() {
-		var position = new Position( [ 0 ], root );
+		let position = new Position( [ 0 ], root );
 
 
 		expect( position ).to.have.property( 'path' ).that.deep.equals( [ 0 ] );
 		expect( position ).to.have.property( 'path' ).that.deep.equals( [ 0 ] );
 		expect( position ).to.have.property( 'root' ).that.equals( root );
 		expect( position ).to.have.property( 'root' ).that.equals( root );
@@ -208,21 +208,21 @@ describe( 'position', function() {
 	} );
 	} );
 
 
 	it( 'should equals another position with the same path', function() {
 	it( 'should equals another position with the same path', function() {
-		var position = new Position( [ 1, 1, 2 ], root );
-		var samePosition = new Position( [ 1, 1, 2 ], root );
+		let position = new Position( [ 1, 1, 2 ], root );
+		let samePosition = new Position( [ 1, 1, 2 ], root );
 
 
 		expect( position.isEqual( samePosition ) ).to.be.true;
 		expect( position.isEqual( samePosition ) ).to.be.true;
 	} );
 	} );
 
 
 	it( 'should not equals another position with the different path', function() {
 	it( 'should not equals another position with the different path', function() {
-		var position = new Position( [ 1, 1, 1 ], root );
-		var differentNode = new Position( [ 1, 2, 2 ], root );
+		let position = new Position( [ 1, 1, 1 ], root );
+		let differentNode = new Position( [ 1, 2, 2 ], root );
 
 
 		expect( position.isEqual( differentNode ) ).to.be.false;
 		expect( position.isEqual( differentNode ) ).to.be.false;
 	} );
 	} );
 
 
 	it( 'should have proper parent path', function() {
 	it( 'should have proper parent path', function() {
-		var position = new Position( [ 1, 2, 3 ], root );
+		let position = new Position( [ 1, 2, 3 ], root );
 
 
 		expect( position.getParentPath() ).to.deep.equal( [ 1, 2 ] );
 		expect( position.getParentPath() ).to.deep.equal( [ 1, 2 ] );
 	} );
 	} );

+ 18 - 18
packages/ckeditor5-utils/tests/document/positioniterator.js

@@ -20,7 +20,7 @@ describe( 'range iterator', function() {
 	let Document, Element, Character, PositionIterator, Position, Range;
 	let Document, Element, Character, PositionIterator, Position, Range;
 	let ELEMENT_ENTER, ELEMENT_LEAVE, CHARACTER;
 	let ELEMENT_ENTER, ELEMENT_LEAVE, CHARACTER;
 
 
-	var doc, expectedItems, root, img1, paragraph, b, a, r, img2, x;
+	let doc, expectedItems, root, img1, paragraph, b, a, r, img2, x;
 
 
 	before( function() {
 	before( function() {
 		Document = modules[ 'document/document' ];
 		Document = modules[ 'document/document' ];
@@ -74,8 +74,8 @@ describe( 'range iterator', function() {
 	} );
 	} );
 
 
 	it( 'should return next position', function() {
 	it( 'should return next position', function() {
-		var iterator = new PositionIterator( new Position( [ 0 ], root ) ); // beginning of root
-		var i, len;
+		let iterator = new PositionIterator( new Position( [ 0 ], root ) ); // beginning of root
+		let i, len;
 
 
 		for ( i = 0, len = expectedItems.length; i < len; i++ ) {
 		for ( i = 0, len = expectedItems.length; i < len; i++ ) {
 			expect( iterator.next() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
 			expect( iterator.next() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
@@ -84,21 +84,21 @@ describe( 'range iterator', function() {
 	} );
 	} );
 
 
 	it( 'should return previous position', function() {
 	it( 'should return previous position', function() {
-		var iterator = new PositionIterator( new Position( [ 2 ], root ) ); // ending of root
+		let iterator = new PositionIterator( new Position( [ 2 ], root ) ); // ending of root
 
 
-		for ( var i = expectedItems.length - 1; i >= 0; i-- ) {
+		for ( let i = expectedItems.length - 1; i >= 0; i-- ) {
 			expect( iterator.previous() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
 			expect( iterator.previous() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
 		}
 		}
 		expect( iterator.previous() ).to.have.property( 'done' ).that.is.true;
 		expect( iterator.previous() ).to.have.property( 'done' ).that.is.true;
 	} );
 	} );
 
 
 	it( 'should return next position in the boundaries', function() {
 	it( 'should return next position in the boundaries', function() {
-		var start = new Position( [ 1, 0 ], root ); // p, 0
-		var end = new Position( [ 1, 3, 0 ], root ); // img, 0
+		let start = new Position( [ 1, 0 ], root ); // p, 0
+		let end = new Position( [ 1, 3, 0 ], root ); // img, 0
 
 
-		var iterator = new PositionIterator( new Range( start, end ) );
+		let iterator = new PositionIterator( new Range( start, end ) );
 
 
-		var i, len;
+		let i, len;
 
 
 		for ( i = 3, len = expectedItems.length; i < 7; i++ ) {
 		for ( i = 3, len = expectedItems.length; i < 7; i++ ) {
 			expect( iterator.next() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
 			expect( iterator.next() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
@@ -107,12 +107,12 @@ describe( 'range iterator', function() {
 	} );
 	} );
 
 
 	it( 'should return previous position in the boundaries', function() {
 	it( 'should return previous position in the boundaries', function() {
-		var start = new Position( [ 1, 0 ], root ); // p, 0
-		var end = new Position( [ 1, 3, 0 ], root ); // img, 0
+		let start = new Position( [ 1, 0 ], root ); // p, 0
+		let end = new Position( [ 1, 3, 0 ], root ); // img, 0
 
 
-		var iterator = new PositionIterator( new Range( start, end ), end );
+		let iterator = new PositionIterator( new Range( start, end ), end );
 
 
-		var i, len;
+		let i, len;
 
 
 		for ( i = 6, len = expectedItems.length; i > 2; i-- ) {
 		for ( i = 6, len = expectedItems.length; i > 2; i-- ) {
 			expect( iterator.previous() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
 			expect( iterator.previous() ).to.deep.equal( { done: false, value: expectedItems[ i ] } );
@@ -121,12 +121,12 @@ describe( 'range iterator', function() {
 	} );
 	} );
 
 
 	it( 'should return iterate over the range', function() {
 	it( 'should return iterate over the range', function() {
-		var start = new Position( [ 0 ], root ); // begging of root
-		var end = new Position( [ 2 ], root ); // ending of root
-		var range = new Range( start, end );
+		let start = new Position( [ 0 ], root ); // begging of root
+		let end = new Position( [ 2 ], root ); // ending of root
+		let range = new Range( start, end );
 
 
-		var i = 0;
-		var value;
+		let i = 0;
+		let value;
 
 
 		for ( value of range ) {
 		for ( value of range ) {
 			expect( value ).to.deep.equal( expectedItems[ i ] );
 			expect( value ).to.deep.equal( expectedItems[ i ] );

+ 11 - 11
packages/ckeditor5-utils/tests/document/range.js

@@ -23,7 +23,7 @@ describe( 'Range', function() {
 		end = new Position( [ 1 ] );
 		end = new Position( [ 1 ] );
 	} );
 	} );
 
 
-	var range;
+	let range;
 
 
 	beforeEach( function() {
 	beforeEach( function() {
 		range = new Range( start, end );
 		range = new Range( start, end );
@@ -38,30 +38,30 @@ describe( 'Range', function() {
 
 
 	describe( 'isEqual', function() {
 	describe( 'isEqual', function() {
 		it( 'should return true if the ranges are the same', function() {
 		it( 'should return true if the ranges are the same', function() {
-			var sameStart = new Position( [ 0 ] );
-			var sameEnd = new Position( [ 1 ] );
+			let sameStart = new Position( [ 0 ] );
+			let sameEnd = new Position( [ 1 ] );
 
 
-			var sameRange = new Range( sameStart, sameEnd );
+			let sameRange = new Range( sameStart, sameEnd );
 
 
 			expect( range.isEqual( sameRange ) ).to.be.true;
 			expect( range.isEqual( sameRange ) ).to.be.true;
 		} );
 		} );
 
 
 		it( 'should return false if the start position is different', function() {
 		it( 'should return false if the start position is different', function() {
-			var range = new Range( start, end );
+			let range = new Range( start, end );
 
 
-			var diffStart = new Position( [ 1 ] );
-			var sameEnd = new Position( [ 1 ] );
+			let diffStart = new Position( [ 1 ] );
+			let sameEnd = new Position( [ 1 ] );
 
 
-			var diffRange = new Range( diffStart, sameEnd );
+			let diffRange = new Range( diffStart, sameEnd );
 
 
 			expect( range.isEqual( diffRange ) ).to.not.be.true;
 			expect( range.isEqual( diffRange ) ).to.not.be.true;
 		} );
 		} );
 
 
 		it( 'should return false if the end position is different', function() {
 		it( 'should return false if the end position is different', function() {
-			var sameStart = new Position( [ 0 ] );
-			var diffEnd = new Position( [ 0 ] );
+			let sameStart = new Position( [ 0 ] );
+			let diffEnd = new Position( [ 0 ] );
 
 
-			var diffRange = new Range( sameStart, diffEnd );
+			let diffRange = new Range( sameStart, diffEnd );
 
 
 			expect( range.isEqual( diffRange ) ).to.not.be.true;
 			expect( range.isEqual( diffRange ) ).to.not.be.true;
 		} );
 		} );

+ 2 - 2
packages/ckeditor5-utils/tests/document/rootelement.js

@@ -26,8 +26,8 @@ describe( 'Element', function() {
 
 
 	describe( 'constructor', function() {
 	describe( 'constructor', function() {
 		it( 'should create root element without attributes', function() {
 		it( 'should create root element without attributes', function() {
-			var doc = new Document();
-			var root = new RootElement( doc );
+			let doc = new Document();
+			let root = new RootElement( doc );
 
 
 			expect( root ).to.be.an.instanceof( Element );
 			expect( root ).to.be.an.instanceof( Element );
 			expect( root ).to.have.property( 'document' ).that.equals( doc );
 			expect( root ).to.have.property( 'document' ).that.equals( doc );

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

@@ -20,8 +20,8 @@ describe( 'Text', function() {
 			const Text = modules[ 'document/text' ];
 			const Text = modules[ 'document/text' ];
 			const Attribute = modules[ 'document/attribute' ];
 			const Attribute = modules[ 'document/attribute' ];
 
 
-			var attrs = [ new Attribute( 'bold', true ) ];
-			var text = new Text( 'bar', attrs );
+			let attrs = [ new Attribute( 'bold', true ) ];
+			let text = new Text( 'bar', attrs );
 
 
 			expect( text ).to.have.property( 'text' ).that.equals( 'bar' );
 			expect( text ).to.have.property( 'text' ).that.equals( 'bar' );
 			expect( text ).to.have.property( 'attrs' ).that.is.an( 'array' );
 			expect( text ).to.have.property( 'attrs' ).that.is.an( 'array' );

+ 59 - 59
packages/ckeditor5-utils/tests/emittermixin/emittermixin.js

@@ -7,15 +7,15 @@
 
 
 const modules = bender.amd.require( 'emittermixin', 'eventinfo', 'utils' );
 const modules = bender.amd.require( 'emittermixin', 'eventinfo', 'utils' );
 
 
-var emitter, listener;
+let emitter, listener;
 
 
 beforeEach( refreshEmitter );
 beforeEach( refreshEmitter );
 
 
 describe( 'fire', function() {
 describe( 'fire', function() {
 	it( 'should execute callbacks in the right order without priority', function() {
 	it( 'should execute callbacks in the right order without priority', function() {
-		var spy1 = sinon.spy().named( 1 );
-		var spy2 = sinon.spy().named( 2 );
-		var spy3 = sinon.spy().named( 3 );
+		let spy1 = sinon.spy().named( 1 );
+		let spy2 = sinon.spy().named( 2 );
+		let spy3 = sinon.spy().named( 3 );
 
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
 		emitter.on( 'test', spy2 );
@@ -27,11 +27,11 @@ describe( 'fire', function() {
 	} );
 	} );
 
 
 	it( 'should execute callbacks in the right order with priority defined', function() {
 	it( 'should execute callbacks in the right order with priority defined', function() {
-		var spy1 = sinon.spy().named( 1 );
-		var spy2 = sinon.spy().named( 2 );
-		var spy3 = sinon.spy().named( 3 );
-		var spy4 = sinon.spy().named( 4 );
-		var spy5 = sinon.spy().named( 5 );
+		let spy1 = sinon.spy().named( 1 );
+		let spy2 = sinon.spy().named( 2 );
+		let spy3 = sinon.spy().named( 3 );
+		let spy4 = sinon.spy().named( 4 );
+		let spy5 = sinon.spy().named( 5 );
 
 
 		emitter.on( 'test', spy2, null, 9 );
 		emitter.on( 'test', spy2, null, 9 );
 		emitter.on( 'test', spy3 );	// Defaults to 10.
 		emitter.on( 'test', spy3 );	// Defaults to 10.
@@ -47,8 +47,8 @@ describe( 'fire', function() {
 	it( 'should pass arguments to callbacks', function() {
 	it( 'should pass arguments to callbacks', function() {
 		const EventInfo = modules.eventinfo;
 		const EventInfo = modules.eventinfo;
 
 
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
 		emitter.on( 'test', spy2 );
@@ -60,12 +60,12 @@ describe( 'fire', function() {
 	} );
 	} );
 
 
 	it( 'should pass proper context to callbacks', function() {
 	it( 'should pass proper context to callbacks', function() {
-		var ctx1 = {};
-		var ctx2 = {};
+		let ctx1 = {};
+		let ctx2 = {};
 
 
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
-		var spy3 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
+		let spy3 = sinon.spy();
 
 
 		emitter.on( 'test', spy1, ctx1 );
 		emitter.on( 'test', spy1, ctx1 );
 		emitter.on( 'test', spy2, ctx2 );
 		emitter.on( 'test', spy2, ctx2 );
@@ -79,8 +79,8 @@ describe( 'fire', function() {
 	} );
 	} );
 
 
 	it( 'should fire the right event', function() {
 	it( 'should fire the right event', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 
 		emitter.on( '1', spy1 );
 		emitter.on( '1', spy1 );
 		emitter.on( '2', spy2 );
 		emitter.on( '2', spy2 );
@@ -92,7 +92,7 @@ describe( 'fire', function() {
 	} );
 	} );
 
 
 	it( 'should execute callbacks many times', function() {
 	it( 'should execute callbacks many times', function() {
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 
 		emitter.on( 'test', spy );
 		emitter.on( 'test', spy );
 
 
@@ -108,7 +108,7 @@ describe( 'fire', function() {
 	} );
 	} );
 
 
 	it( 'should accept the same callback many times', function() {
 	it( 'should accept the same callback many times', function() {
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 
 		emitter.on( 'test', spy );
 		emitter.on( 'test', spy );
 		emitter.on( 'test', spy );
 		emitter.on( 'test', spy );
@@ -122,9 +122,9 @@ describe( 'fire', function() {
 
 
 describe( 'on', function() {
 describe( 'on', function() {
 	it( 'should stop()', function() {
 	it( 'should stop()', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
-		var spy3 = sinon.spy( function( event ) {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
+		let spy3 = sinon.spy( function( event ) {
 			event.stop();
 			event.stop();
 		} );
 		} );
 
 
@@ -142,11 +142,11 @@ describe( 'on', function() {
 	} );
 	} );
 
 
 	it( 'should take a callback off()', function() {
 	it( 'should take a callback off()', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy( function( event ) {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy( function( event ) {
 			event.off();
 			event.off();
 		} );
 		} );
-		var spy3 = sinon.spy();
+		let spy3 = sinon.spy();
 
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
 		emitter.on( 'test', spy2 );
@@ -161,11 +161,11 @@ describe( 'on', function() {
 	} );
 	} );
 
 
 	it( 'should take the callback off() even after stop()', function() {
 	it( 'should take the callback off() even after stop()', function() {
-		var spy1 = sinon.spy( function( event ) {
+		let spy1 = sinon.spy( function( event ) {
 			event.stop();
 			event.stop();
 			event.off();
 			event.off();
 		} );
 		} );
-		var spy2 = sinon.spy();
+		let spy2 = sinon.spy();
 
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
 		emitter.on( 'test', spy2 );
@@ -180,9 +180,9 @@ describe( 'on', function() {
 
 
 describe( 'once', function() {
 describe( 'once', function() {
 	it( 'should be called just once', function() {
 	it( 'should be called just once', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
-		var spy3 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
+		let spy3 = sinon.spy();
 
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy1 );
 		emitter.once( 'test', spy2 );
 		emitter.once( 'test', spy2 );
@@ -197,10 +197,10 @@ describe( 'once', function() {
 	} );
 	} );
 
 
 	it( 'should have proper scope', function() {
 	it( 'should have proper scope', function() {
-		var ctx = {};
+		let ctx = {};
 
 
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 
 		emitter.once( 'test', spy1, ctx );
 		emitter.once( 'test', spy1, ctx );
 		emitter.once( 'test', spy2 );
 		emitter.once( 'test', spy2 );
@@ -214,7 +214,7 @@ describe( 'once', function() {
 	it( 'should have proper arguments', function() {
 	it( 'should have proper arguments', function() {
 		const EventInfo = modules.eventinfo;
 		const EventInfo = modules.eventinfo;
 
 
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 
 		emitter.once( 'test', spy );
 		emitter.once( 'test', spy );
 
 
@@ -226,9 +226,9 @@ describe( 'once', function() {
 
 
 describe( 'off', function() {
 describe( 'off', function() {
 	it( 'should get callbacks off()', function() {
 	it( 'should get callbacks off()', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
-		var spy3 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
+		let spy3 = sinon.spy();
 
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
 		emitter.on( 'test', spy2 );
@@ -251,8 +251,8 @@ describe( 'off', function() {
 	} );
 	} );
 
 
 	it( 'should remove all entries for the same callback', function() {
 	it( 'should remove all entries for the same callback', function() {
-		var spy1 = sinon.spy().named( 1 );
-		var spy2 = sinon.spy().named( 2 );
+		let spy1 = sinon.spy().named( 1 );
+		let spy2 = sinon.spy().named( 2 );
 
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
 		emitter.on( 'test', spy2 );
@@ -270,10 +270,10 @@ describe( 'off', function() {
 	} );
 	} );
 
 
 	it( 'should remove the callback for a specific context only', function() {
 	it( 'should remove the callback for a specific context only', function() {
-		var spy = sinon.spy().named( 1 );
+		let spy = sinon.spy().named( 1 );
 
 
-		var ctx1 = { ctx: 1 };
-		var ctx2 = { ctx: 2 };
+		let ctx1 = { ctx: 1 };
+		let ctx2 = { ctx: 2 };
 
 
 		emitter.on( 'test', spy, ctx1 );
 		emitter.on( 'test', spy, ctx1 );
 		emitter.on( 'test', spy, ctx2 );
 		emitter.on( 'test', spy, ctx2 );
@@ -295,7 +295,7 @@ describe( 'listenTo', function() {
 	beforeEach( refreshListener );
 	beforeEach( refreshListener );
 
 
 	it( 'should properly register callbacks', function() {
 	it( 'should properly register callbacks', function() {
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 
 		listener.listenTo( emitter, 'test', spy );
 		listener.listenTo( emitter, 'test', spy );
 
 
@@ -309,8 +309,8 @@ describe( 'stopListening', function() {
 	beforeEach( refreshListener );
 	beforeEach( refreshListener );
 
 
 	it( 'should stop listening to a specific event callback', function() {
 	it( 'should stop listening to a specific event callback', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 
 		listener.listenTo( emitter, 'event1', spy1 );
 		listener.listenTo( emitter, 'event1', spy1 );
 		listener.listenTo( emitter, 'event2', spy2 );
 		listener.listenTo( emitter, 'event2', spy2 );
@@ -328,9 +328,9 @@ describe( 'stopListening', function() {
 	} );
 	} );
 
 
 	it( 'should stop listening to an specific event', function() {
 	it( 'should stop listening to an specific event', function() {
-		var spy1a = sinon.spy();
-		var spy1b = sinon.spy();
-		var spy2 = sinon.spy();
+		let spy1a = sinon.spy();
+		let spy1b = sinon.spy();
+		let spy2 = sinon.spy();
 
 
 		listener.listenTo( emitter, 'event1', spy1a );
 		listener.listenTo( emitter, 'event1', spy1a );
 		listener.listenTo( emitter, 'event1', spy1b );
 		listener.listenTo( emitter, 'event1', spy1b );
@@ -350,8 +350,8 @@ describe( 'stopListening', function() {
 	} );
 	} );
 
 
 	it( 'should stop listening to all events from a specific emitter', function() {
 	it( 'should stop listening to all events from a specific emitter', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 
 		listener.listenTo( emitter, 'event1', spy1 );
 		listener.listenTo( emitter, 'event1', spy1 );
 		listener.listenTo( emitter, 'event2', spy2 );
 		listener.listenTo( emitter, 'event2', spy2 );
@@ -369,11 +369,11 @@ describe( 'stopListening', function() {
 	} );
 	} );
 
 
 	it( 'should stop listening to everything', function() {
 	it( 'should stop listening to everything', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 
-		var emitter1 = getEmitterInstance();
-		var emitter2 = getEmitterInstance();
+		let emitter1 = getEmitterInstance();
+		let emitter2 = getEmitterInstance();
 
 
 		listener.listenTo( emitter1, 'event1', spy1 );
 		listener.listenTo( emitter1, 'event1', spy1 );
 		listener.listenTo( emitter2, 'event2', spy2 );
 		listener.listenTo( emitter2, 'event2', spy2 );
@@ -395,10 +395,10 @@ describe( 'stopListening', function() {
 	} );
 	} );
 
 
 	it( 'should not stop other emitters when a non-listened emitter is provided', function() {
 	it( 'should not stop other emitters when a non-listened emitter is provided', function() {
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 
-		var emitter1 = getEmitterInstance();
-		var emitter2 = getEmitterInstance();
+		let emitter1 = getEmitterInstance();
+		let emitter2 = getEmitterInstance();
 
 
 		listener.listenTo( emitter1, 'test', spy );
 		listener.listenTo( emitter1, 'test', spy );
 
 
@@ -420,7 +420,7 @@ function refreshListener() {
 
 
 function getEmitterInstance() {
 function getEmitterInstance() {
 	const EmitterMixin = modules.emittermixin;
 	const EmitterMixin = modules.emittermixin;
-	var utils = modules.utils;
+	let utils = modules.utils;
 
 
 	return utils.extend( {}, EmitterMixin );
 	return utils.extend( {}, EmitterMixin );
 }
 }

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

@@ -11,7 +11,7 @@ describe( 'EventInfo', function() {
 	it( 'should be created properly', function() {
 	it( 'should be created properly', function() {
 		const EventInfo = modules.eventinfo;
 		const EventInfo = modules.eventinfo;
 
 
-		var event = new EventInfo( this, 'test' );
+		let event = new EventInfo( this, 'test' );
 
 
 		expect( event.source ).to.equal( this );
 		expect( event.source ).to.equal( this );
 		expect( event.name ).to.equal( 'test' );
 		expect( event.name ).to.equal( 'test' );
@@ -22,7 +22,7 @@ describe( 'EventInfo', function() {
 	it( 'should have stop() and off() marked', function() {
 	it( 'should have stop() and off() marked', function() {
 		const EventInfo = modules.eventinfo;
 		const EventInfo = modules.eventinfo;
 
 
-		var event = new EventInfo( this, 'test' );
+		let event = new EventInfo( this, 'test' );
 
 
 		event.stop();
 		event.stop();
 		event.off();
 		event.off();
@@ -34,7 +34,7 @@ describe( 'EventInfo', function() {
 	it( 'should not mark "called" in future instances', function() {
 	it( 'should not mark "called" in future instances', function() {
 		const EventInfo = modules.eventinfo;
 		const EventInfo = modules.eventinfo;
 
 
-		var event = new EventInfo( this, 'test' );
+		let event = new EventInfo( this, 'test' );
 
 
 		event.stop();
 		event.stop();
 		event.off();
 		event.off();

+ 7 - 7
packages/ckeditor5-utils/tests/log/log.js

@@ -8,7 +8,7 @@
 'use strict';
 'use strict';
 
 
 const modules = bender.amd.require( 'log' );
 const modules = bender.amd.require( 'log' );
-var spy;
+let spy;
 
 
 beforeEach( function() {
 beforeEach( function() {
 	if ( spy ) {
 	if ( spy ) {
@@ -18,9 +18,9 @@ beforeEach( function() {
 
 
 describe( 'warn()', function() {
 describe( 'warn()', function() {
 	it( 'logs the message to the console using console.warn()', function() {
 	it( 'logs the message to the console using console.warn()', function() {
-		var log = modules.log;
-		var spy = sinon.stub( console, 'warn' );
-		var data = { bar: 1 };
+		let log = modules.log;
+		let spy = sinon.stub( console, 'warn' );
+		let data = { bar: 1 };
 
 
 		log.warn( 'foo', data );
 		log.warn( 'foo', data );
 
 
@@ -35,9 +35,9 @@ describe( 'warn()', function() {
 
 
 describe( 'error()', function() {
 describe( 'error()', function() {
 	it( 'logs the message to the console using console.error()', function() {
 	it( 'logs the message to the console using console.error()', function() {
-		var log = modules.log;
-		var spy = sinon.stub( console, 'error' );
-		var data = { bar: 1 };
+		let log = modules.log;
+		let spy = sinon.stub( console, 'error' );
+		let data = { bar: 1 };
 
 
 		log.error( 'foo', data );
 		log.error( 'foo', data );
 
 

+ 8 - 8
packages/ckeditor5-utils/tests/mvc/model/model.js

@@ -44,7 +44,7 @@ describe( 'Model', function() {
 	} );
 	} );
 
 
 	it( 'should add properties on creation', function() {
 	it( 'should add properties on creation', function() {
-		var car = new Car( null, {
+		let car = new Car( null, {
 			prop: 1
 			prop: 1
 		} );
 		} );
 
 
@@ -83,10 +83,10 @@ describe( 'Model', function() {
 		it( 'should fire the "change" event', function() {
 		it( 'should fire the "change" event', function() {
 			const EventInfo = modules.eventinfo;
 			const EventInfo = modules.eventinfo;
 
 
-			var spy = sinon.spy();
-			var spyColor = sinon.spy();
-			var spyYear = sinon.spy();
-			var spyWheels = sinon.spy();
+			let spy = sinon.spy();
+			let spyColor = sinon.spy();
+			let spyYear = sinon.spy();
+			let spyWheels = sinon.spy();
 
 
 			car.on( 'change', spy );
 			car.on( 'change', spy );
 			car.on( 'change:color', spyColor );
 			car.on( 'change:color', spyColor );
@@ -120,8 +120,8 @@ describe( 'Model', function() {
 		} );
 		} );
 
 
 		it( 'should not fire the "change" event for the same attribute value', function() {
 		it( 'should not fire the "change" event for the same attribute value', function() {
-			var spy = sinon.spy();
-			var spyColor = sinon.spy();
+			let spy = sinon.spy();
+			let spyColor = sinon.spy();
 
 
 			car.on( 'change', spy );
 			car.on( 'change', spy );
 			car.on( 'change:color', spyColor );
 			car.on( 'change:color', spyColor );
@@ -171,7 +171,7 @@ describe( 'Model', function() {
 
 
 			class Truck extends Car {}
 			class Truck extends Car {}
 
 
-			var truck = new Truck();
+			let truck = new Truck();
 
 
 			expect( truck ).to.be.an.instanceof( Car );
 			expect( truck ).to.be.an.instanceof( Car );
 			expect( truck ).to.be.an.instanceof( Model );
 			expect( truck ).to.be.an.instanceof( Model );

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

@@ -6,7 +6,7 @@
 'use strict';
 'use strict';
 
 
 const modules = bender.amd.require( 'plugin', 'editor' );
 const modules = bender.amd.require( 'plugin', 'editor' );
-var editor;
+let editor;
 
 
 before( function() {
 before( function() {
 	const Editor = modules.editor;
 	const Editor = modules.editor;
@@ -18,7 +18,7 @@ describe( 'constructor', function() {
 	it( 'should set the `editor` property', function() {
 	it( 'should set the `editor` property', function() {
 		const Plugin = modules.plugin;
 		const Plugin = modules.plugin;
 
 
-		var plugin = new Plugin( editor );
+		let plugin = new Plugin( editor );
 
 
 		expect( plugin ).to.have.property( 'editor' ).to.equal( editor );
 		expect( plugin ).to.have.property( 'editor' ).to.equal( editor );
 	} );
 	} );

+ 28 - 28
packages/ckeditor5-utils/tests/utils/utils.js

@@ -8,7 +8,7 @@
 const modules = bender.amd.require( 'utils', 'utils-lodash' );
 const modules = bender.amd.require( 'utils', 'utils-lodash' );
 
 
 describe( 'utils', function() {
 describe( 'utils', function() {
-	var utils;
+	let utils;
 
 
 	before( function() {
 	before( function() {
 		utils = modules.utils;
 		utils = modules.utils;
@@ -18,17 +18,17 @@ describe( 'utils', function() {
 		// Properties of the subsequent objects should override properties of the preceding objects. This is critical for
 		// Properties of the subsequent objects should override properties of the preceding objects. This is critical for
 		// CKEditor so we keep this test to ensure that Lo-Dash (or whatever) implements it in the way we need it.
 		// CKEditor so we keep this test to ensure that Lo-Dash (or whatever) implements it in the way we need it.
 		it( 'should extend by several params in the correct order', function() {
 		it( 'should extend by several params in the correct order', function() {
-			var target = {
+			let target = {
 				a: 0,
 				a: 0,
 				b: 0
 				b: 0
 			};
 			};
 
 
-			var ext1 = {
+			let ext1 = {
 				b: 1,
 				b: 1,
 				c: 1
 				c: 1
 			};
 			};
 
 
-			var ext2 = {
+			let ext2 = {
 				c: 2,
 				c: 2,
 				d: 2
 				d: 2
 			};
 			};
@@ -44,14 +44,14 @@ describe( 'utils', function() {
 
 
 	describe( 'spy', function() {
 	describe( 'spy', function() {
 		it( 'should not have `called` after creation', function() {
 		it( 'should not have `called` after creation', function() {
-			var spy = utils.spy();
+			let spy = utils.spy();
 
 
 			expect( spy.called ).to.not.be.true();
 			expect( spy.called ).to.not.be.true();
 		} );
 		} );
 
 
 		it( 'should register calls', function() {
 		it( 'should register calls', function() {
-			var fn1 = utils.spy();
-			var fn2 = utils.spy();
+			let fn1 = utils.spy();
+			let fn2 = utils.spy();
 
 
 			fn1();
 			fn1();
 
 
@@ -62,9 +62,9 @@ describe( 'utils', function() {
 
 
 	describe( 'uid', function() {
 	describe( 'uid', function() {
 		it( 'should return different ids', function() {
 		it( 'should return different ids', function() {
-			var id1 = utils.uid();
-			var id2 = utils.uid();
-			var id3 = utils.uid();
+			let id1 = utils.uid();
+			let id2 = utils.uid();
+			let id3 = utils.uid();
 
 
 			expect( id1 ).to.be.a( 'number' );
 			expect( id1 ).to.be.a( 'number' );
 			expect( id2 ).to.be.a( 'number' ).to.not.equal( id1 ).to.not.equal( id3 );
 			expect( id2 ).to.be.a( 'number' ).to.not.equal( id1 ).to.not.equal( id3 );
@@ -74,13 +74,13 @@ describe( 'utils', function() {
 
 
 	describe( 'isIterable', function() {
 	describe( 'isIterable', function() {
 		it( 'should be true for string', function() {
 		it( 'should be true for string', function() {
-			var string = 'foo';
+			let string = 'foo';
 
 
 			expect( utils.isIterable( string ) ).to.be.true;
 			expect( utils.isIterable( string ) ).to.be.true;
 		} );
 		} );
 
 
 		it( 'should be true for arrays', function() {
 		it( 'should be true for arrays', function() {
-			var array = [ 1, 2, 3 ];
+			let array = [ 1, 2, 3 ];
 
 
 			expect( utils.isIterable( array ) ).to.be.true;
 			expect( utils.isIterable( array ) ).to.be.true;
 		} );
 		} );
@@ -96,13 +96,13 @@ describe( 'utils', function() {
 				}
 				}
 			}
 			}
 
 
-			var instance = new IterableClass();
+			let instance = new IterableClass();
 
 
 			expect( utils.isIterable( instance ) ).to.be.true;
 			expect( utils.isIterable( instance ) ).to.be.true;
 		} );
 		} );
 
 
 		it( 'should be false for not iterable objects', function() {
 		it( 'should be false for not iterable objects', function() {
-			var notIterable = { foo: 'bar' };
+			let notIterable = { foo: 'bar' };
 
 
 			expect( utils.isIterable( notIterable ) ).to.be.false;
 			expect( utils.isIterable( notIterable ) ).to.be.false;
 		} );
 		} );
@@ -114,37 +114,37 @@ describe( 'utils', function() {
 
 
 	describe( 'compareArrays', function() {
 	describe( 'compareArrays', function() {
 		it( 'should return SAME flag, when arrays are same', function() {
 		it( 'should return SAME flag, when arrays are same', function() {
-			var a = [ 'abc', 0, 3 ];
-			var b = [ 'abc', 0, 3 ];
+			let a = [ 'abc', 0, 3 ];
+			let b = [ 'abc', 0, 3 ];
 
 
-			var result = utils.compareArrays( a, b );
+			let result = utils.compareArrays( a, b );
 
 
 			expect( result ).to.equal( utils.compareArrays.SAME );
 			expect( result ).to.equal( utils.compareArrays.SAME );
 		} );
 		} );
 
 
 		it( 'should return PREFIX flag, when all n elements of first array are same as n first elements of the second array', function() {
 		it( 'should return PREFIX flag, when all n elements of first array are same as n first elements of the second array', function() {
-			var a = [ 'abc', 0 ];
-			var b = [ 'abc', 0, 3 ];
+			let a = [ 'abc', 0 ];
+			let b = [ 'abc', 0, 3 ];
 
 
-			var result = utils.compareArrays( a, b );
+			let result = utils.compareArrays( a, b );
 
 
 			expect( result ).to.equal( utils.compareArrays.PREFIX );
 			expect( result ).to.equal( utils.compareArrays.PREFIX );
 		} );
 		} );
 
 
 		it( 'should return EXTENSION flag, when n first elements of first array are same as all elements of the second array', function() {
 		it( 'should return EXTENSION flag, when n first elements of first array are same as all elements of the second array', function() {
-			var a = [ 'abc', 0, 3 ];
-			var b = [ 'abc', 0 ];
+			let a = [ 'abc', 0, 3 ];
+			let b = [ 'abc', 0 ];
 
 
-			var result = utils.compareArrays( a, b );
+			let result = utils.compareArrays( a, b );
 
 
 			expect( result ).to.equal( utils.compareArrays.EXTENSION );
 			expect( result ).to.equal( utils.compareArrays.EXTENSION );
 		} );
 		} );
 
 
 		it( 'should return DIFFERENT flag, when arrays are not same', function() {
 		it( 'should return DIFFERENT flag, when arrays are not same', function() {
-			var a = [ 'abc', 0, 3 ];
-			var b = [ 'abc', 1, 3 ];
+			let a = [ 'abc', 0, 3 ];
+			let b = [ 'abc', 1, 3 ];
 
 
-			var result = utils.compareArrays( a, b );
+			let result = utils.compareArrays( a, b );
 
 
 			expect( result ).to.equal( utils.compareArrays.DIFFERENT );
 			expect( result ).to.equal( utils.compareArrays.DIFFERENT );
 		} );
 		} );
@@ -153,8 +153,8 @@ describe( 'utils', function() {
 	describe( 'Lo-Dash extensions', function() {
 	describe( 'Lo-Dash extensions', function() {
 		// Ensures that the required Lo-Dash extensions are available in `utils`.
 		// Ensures that the required Lo-Dash extensions are available in `utils`.
 		it( 'should be exposed in utils', function() {
 		it( 'should be exposed in utils', function() {
-			var utils = modules.utils;
-			var extensions = modules[ 'utils-lodash' ];
+			let utils = modules.utils;
+			let extensions = modules[ 'utils-lodash' ];
 
 
 			extensions.forEach( function( extension ) {
 			extensions.forEach( function( extension ) {
 				expect( utils ).to.have.property( extension ).to.not.be.undefined();
 				expect( utils ).to.have.property( extension ).to.not.be.undefined();