Browse Source

Tests: Replaced remaining var with let.

Piotrek Koszuliński 10 years ago
parent
commit
035359d4c4

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

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

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

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

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

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

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

@@ -7,7 +7,7 @@
 
 const modules = bender.amd.require( 'config' );
 
-var config;
+let config;
 
 beforeEach( function() {
 	const Config = modules.config;
@@ -179,13 +179,13 @@ describe( 'get', 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( 'maxheight' ).to.equal( 800 );
 		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' );
 	} );

+ 1 - 1
packages/ckeditor5-ui/tests/editorconfig/editorconfig.js

@@ -7,7 +7,7 @@
 
 const modules = bender.amd.require( 'editorconfig', 'ckeditor' );
 
-var config;
+let config;
 
 beforeEach( function() {
 	const EditorConfig = modules.editorconfig;

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

@@ -7,15 +7,15 @@
 
 const modules = bender.amd.require( 'emittermixin', 'eventinfo', 'utils' );
 
-var emitter, listener;
+let emitter, listener;
 
 beforeEach( refreshEmitter );
 
 describe( 'fire', 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', spy2 );
@@ -27,11 +27,11 @@ describe( 'fire', 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', spy3 );	// Defaults to 10.
@@ -47,8 +47,8 @@ describe( 'fire', function() {
 	it( 'should pass arguments to callbacks', function() {
 		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', spy2 );
@@ -60,12 +60,12 @@ describe( 'fire', 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', spy2, ctx2 );
@@ -79,8 +79,8 @@ describe( 'fire', 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( '2', spy2 );
@@ -92,7 +92,7 @@ describe( 'fire', function() {
 	} );
 
 	it( 'should execute callbacks many times', function() {
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 		emitter.on( 'test', spy );
 
@@ -108,7 +108,7 @@ describe( 'fire', 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 );
@@ -122,9 +122,9 @@ describe( 'fire', function() {
 
 describe( 'on', 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();
 		} );
 
@@ -142,11 +142,11 @@ describe( 'on', 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();
 		} );
-		var spy3 = sinon.spy();
+		let spy3 = sinon.spy();
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
@@ -161,11 +161,11 @@ describe( 'on', 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.off();
 		} );
-		var spy2 = sinon.spy();
+		let spy2 = sinon.spy();
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
@@ -180,9 +180,9 @@ describe( 'on', function() {
 
 describe( '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.once( 'test', spy2 );
@@ -197,10 +197,10 @@ describe( 'once', 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', spy2 );
@@ -214,7 +214,7 @@ describe( 'once', function() {
 	it( 'should have proper arguments', function() {
 		const EventInfo = modules.eventinfo;
 
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 		emitter.once( 'test', spy );
 
@@ -226,9 +226,9 @@ describe( 'once', function() {
 
 describe( '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', spy2 );
@@ -251,8 +251,8 @@ describe( 'off', 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', spy2 );
@@ -270,10 +270,10 @@ describe( 'off', 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, ctx2 );
@@ -295,7 +295,7 @@ describe( 'listenTo', function() {
 	beforeEach( refreshListener );
 
 	it( 'should properly register callbacks', function() {
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 		listener.listenTo( emitter, 'test', spy );
 
@@ -309,8 +309,8 @@ describe( 'stopListening', function() {
 	beforeEach( refreshListener );
 
 	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, 'event2', spy2 );
@@ -328,9 +328,9 @@ describe( 'stopListening', 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', spy1b );
@@ -350,8 +350,8 @@ describe( 'stopListening', 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, 'event2', spy2 );
@@ -369,11 +369,11 @@ describe( 'stopListening', 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( emitter2, 'event2', spy2 );
@@ -395,10 +395,10 @@ describe( 'stopListening', 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 );
 
@@ -420,7 +420,7 @@ function refreshListener() {
 
 function getEmitterInstance() {
 	const EmitterMixin = modules.emittermixin;
-	var utils = modules.utils;
+	let utils = modules.utils;
 
 	return utils.extend( {}, EmitterMixin );
 }

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

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

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

@@ -8,7 +8,7 @@
 'use strict';
 
 const modules = bender.amd.require( 'log' );
-var spy;
+let spy;
 
 beforeEach( function() {
 	if ( spy ) {
@@ -18,9 +18,9 @@ beforeEach( function() {
 
 describe( '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 );
 
@@ -35,9 +35,9 @@ describe( 'warn()', function() {
 
 describe( '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 );
 

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

@@ -44,7 +44,7 @@ describe( 'Model', function() {
 	} );
 
 	it( 'should add properties on creation', function() {
-		var car = new Car( null, {
+		let car = new Car( null, {
 			prop: 1
 		} );
 
@@ -83,10 +83,10 @@ describe( 'Model', function() {
 		it( 'should fire the "change" event', function() {
 			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:color', spyColor );
@@ -120,8 +120,8 @@ describe( 'Model', 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:color', spyColor );
@@ -171,7 +171,7 @@ describe( 'Model', function() {
 
 			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( Model );

+ 49 - 49
packages/ckeditor5-ui/tests/ui/domemittermixin.js

@@ -9,13 +9,13 @@
 'use strict';
 
 const modules = bender.amd.require( 'utils', 'ui/domemittermixin', 'emittermixin' );
-var emitter, domEmitter, node;
+let emitter, domEmitter, node;
 
 bender.tools.createSinonSandbox();
 
-var getEmitterInstance = () => modules.utils.extend( {}, modules.emittermixin );
-var getDOMEmitterInstance = () => modules.utils.extend( {}, modules[ 'ui/domemittermixin' ] );
-var getDOMNodeInstance = () => document.createElement( 'div' );
+let getEmitterInstance = () => modules.utils.extend( {}, modules.emittermixin );
+let getDOMEmitterInstance = () => modules.utils.extend( {}, modules[ 'ui/domemittermixin' ] );
+let getDOMNodeInstance = () => document.createElement( 'div' );
 
 function updateEmitterInstance() {
 	emitter = getEmitterInstance();
@@ -35,7 +35,7 @@ beforeEach( updateDOMNodeInstance );
 
 describe( 'listenTo', function() {
 	it( 'should listen to EmitterMixin events', function() {
-		var spy = bender.sinon.spy();
+		let spy = bender.sinon.spy();
 
 		domEmitter.listenTo( emitter, 'test', spy );
 		emitter.fire( 'test' );
@@ -44,11 +44,11 @@ describe( 'listenTo', function() {
 	} );
 
 	it( 'should listen to native DOM events', function() {
-		var spy = bender.sinon.spy();
+		let spy = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'test', spy );
 
-		var event = new Event( 'test' );
+		let event = new Event( 'test' );
 		node.dispatchEvent( event );
 
 		sinon.assert.calledOnce( spy );
@@ -57,8 +57,8 @@ describe( 'listenTo', function() {
 
 describe( 'stopListening', function() {
 	it( 'should stop listening to a specific event callback', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'event1', spy1 );
 		domEmitter.listenTo( node, 'event2', spy2 );
@@ -76,9 +76,9 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should stop listening to an specific event', function() {
-		var spy1a = bender.sinon.spy();
-		var spy1b = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1a = bender.sinon.spy();
+		let spy1b = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'event1', spy1a );
 		domEmitter.listenTo( node, 'event1', spy1b );
@@ -102,8 +102,8 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should stop listening to all events from a specific node', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'event1', spy1 );
 		domEmitter.listenTo( node, 'event2', spy2 );
@@ -121,11 +121,11 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should stop listening to everything', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
-		var node1 = getDOMNodeInstance();
-		var node2 = getDOMNodeInstance();
+		let node1 = getDOMNodeInstance();
+		let node2 = getDOMNodeInstance();
 
 		domEmitter.listenTo( node1, 'event1', spy1 );
 		domEmitter.listenTo( node2, 'event2', spy2 );
@@ -147,10 +147,10 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should not stop other nodes when a non-listened node is provided', function() {
-		var spy = bender.sinon.spy();
+		let spy = bender.sinon.spy();
 
-		var node1 = getDOMNodeInstance();
-		var node2 = getDOMNodeInstance();
+		let node1 = getDOMNodeInstance();
+		let node2 = getDOMNodeInstance();
 
 		domEmitter.listenTo( node1, 'test', spy );
 
@@ -162,13 +162,13 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should pass DOM Event data to the listener', function() {
-		var spy = bender.sinon.spy();
+		let spy = bender.sinon.spy();
 
-		var node = getDOMNodeInstance();
+		let node = getDOMNodeInstance();
 
 		domEmitter.listenTo( node, 'click', spy );
 
-		var mouseEvent = new MouseEvent( 'click', {
+		let mouseEvent = new MouseEvent( 'click', {
 			screenX: 10,
 			screenY: 20
 		} );
@@ -180,13 +180,13 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should detach native DOM event listener proxy, specific event', function() {
-		var spy1a = bender.sinon.spy();
-		var spy1b = bender.sinon.spy();
+		let spy1a = bender.sinon.spy();
+		let spy1b = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'test', spy1a );
 
-		var proxyEmitter = domEmitter._getProxyEmitter( node );
-		var spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
+		let proxyEmitter = domEmitter._getProxyEmitter( node );
+		let spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
 
 		node.dispatchEvent( new Event( 'test' ) );
 
@@ -211,15 +211,15 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should detach native DOM event listener proxy, specific callback', function() {
-		var spy1a = bender.sinon.spy();
-		var spy1b = bender.sinon.spy();
-		var spy1c = bender.sinon.spy();
+		let spy1a = bender.sinon.spy();
+		let spy1b = bender.sinon.spy();
+		let spy1c = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'test', spy1a );
 		domEmitter.listenTo( node, 'test', spy1b );
 
-		var proxyEmitter = domEmitter._getProxyEmitter( node );
-		var spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
+		let proxyEmitter = domEmitter._getProxyEmitter( node );
+		let spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
 
 		node.dispatchEvent( new Event( 'test' ) );
 
@@ -254,16 +254,16 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should detach native DOM event listener proxy, specific emitter', function() {
-		var spy1a = bender.sinon.spy();
-		var spy1b = bender.sinon.spy();
-		var spy1c = bender.sinon.spy();
-		var spy1d = bender.sinon.spy();
+		let spy1a = bender.sinon.spy();
+		let spy1b = bender.sinon.spy();
+		let spy1c = bender.sinon.spy();
+		let spy1d = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'test1', spy1a );
 		domEmitter.listenTo( node, 'test2', spy1b );
 
-		var proxyEmitter = domEmitter._getProxyEmitter( node );
-		var spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
+		let proxyEmitter = domEmitter._getProxyEmitter( node );
+		let spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
 
 		node.dispatchEvent( new Event( 'test1' ) );
 		node.dispatchEvent( new Event( 'test2' ) );
@@ -286,8 +286,8 @@ describe( 'stopListening', function() {
 		domEmitter.listenTo( node, 'test2', spy1d );
 
 		// Old proxy emitter died when stopped listening to the node.
-		var proxyEmitter2 = domEmitter._getProxyEmitter( node );
-		var spy3 = bender.sinon.spy( proxyEmitter2, 'fire' );
+		let proxyEmitter2 = domEmitter._getProxyEmitter( node );
+		let spy3 = bender.sinon.spy( proxyEmitter2, 'fire' );
 
 		node.dispatchEvent( new Event( 'test1' ) );
 		node.dispatchEvent( new Event( 'test2' ) );
@@ -303,16 +303,16 @@ describe( 'stopListening', function() {
 	} );
 
 	it( 'should detach native DOM event listener proxy, everything', function() {
-		var spy1a = bender.sinon.spy();
-		var spy1b = bender.sinon.spy();
-		var spy1c = bender.sinon.spy();
-		var spy1d = bender.sinon.spy();
+		let spy1a = bender.sinon.spy();
+		let spy1b = bender.sinon.spy();
+		let spy1c = bender.sinon.spy();
+		let spy1d = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'test1', spy1a );
 		domEmitter.listenTo( node, 'test2', spy1b );
 
-		var proxyEmitter = domEmitter._getProxyEmitter( node );
-		var spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
+		let proxyEmitter = domEmitter._getProxyEmitter( node );
+		let spy2 = bender.sinon.spy( proxyEmitter, 'fire' );
 
 		node.dispatchEvent( new Event( 'test1' ) );
 		node.dispatchEvent( new Event( 'test2' ) );
@@ -335,8 +335,8 @@ describe( 'stopListening', function() {
 		domEmitter.listenTo( node, 'test2', spy1d );
 
 		// Old proxy emitter died when stopped listening to the node.
-		var proxyEmitter2 = domEmitter._getProxyEmitter( node );
-		var spy3 = bender.sinon.spy( proxyEmitter2, 'fire' );
+		let proxyEmitter2 = domEmitter._getProxyEmitter( node );
+		let spy3 = bender.sinon.spy( proxyEmitter2, 'fire' );
 
 		node.dispatchEvent( new Event( 'test1' ) );
 		node.dispatchEvent( new Event( 'test2' ) );

+ 6 - 6
packages/ckeditor5-ui/tests/ui/region.js

@@ -13,7 +13,7 @@ const modules = bender.amd.require( 'ckeditor', 'ui/region', 'ui/view', 'collect
 bender.tools.createSinonSandbox();
 
 let TestViewA, TestViewB;
-var region, el;
+let region, el;
 
 beforeEach( createRegionInstance );
 
@@ -41,8 +41,8 @@ describe( 'views collection', function() {
 	} );
 
 	it( 'updates DOM when removing views', function() {
-		var viewA = new TestViewA();
-		var viewB = new TestViewB();
+		let viewA = new TestViewA();
+		let viewB = new TestViewB();
 
 		region.views.add( viewA );
 		region.views.add( viewB );
@@ -63,7 +63,7 @@ describe( 'views collection', function() {
 describe( 'destroy', function() {
 	it( 'destroys the region', function() {
 		// Append the region's element to some container.
-		var container = document.createElement( 'div' );
+		let container = document.createElement( 'div' );
 		container.appendChild( el );
 		expect( el.parentNode ).to.be.equal( container );
 
@@ -75,8 +75,8 @@ describe( 'destroy', function() {
 	} );
 
 	it( 'destroys children views', function() {
-		var view = new TestViewA();
-		var spy = bender.sinon.spy( view, 'destroy' );
+		let view = new TestViewA();
+		let spy = bender.sinon.spy( view, 'destroy' );
 
 		// Append the view to the region.
 		region.views.add( view );

+ 19 - 19
packages/ckeditor5-ui/tests/ui/template.js

@@ -16,7 +16,7 @@ beforeEach( createClassReferences );
 
 describe( 'constructor', function() {
 	it( 'accepts the definition', function() {
-		var def = {
+		let def = {
 			tag: 'p'
 		};
 
@@ -30,7 +30,7 @@ describe( 'render', function() {
 	} );
 
 	it( 'creates an element', function() {
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			attrs: {
 				'class': [ 'a', 'b' ],
@@ -46,7 +46,7 @@ describe( 'render', function() {
 	} );
 
 	it( 'creates element\'s children', function() {
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			attrs: {
 				a: 'A'
@@ -75,10 +75,10 @@ describe( 'render', function() {
 
 describe( 'callback value', function() {
 	it( 'works for attributes', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			attrs: {
 				'class': spy1
@@ -103,10 +103,10 @@ describe( 'callback value', function() {
 	} );
 
 	it( 'works for "text" property', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			text: spy1,
 			children: [
@@ -128,12 +128,12 @@ describe( 'callback value', function() {
 	} );
 
 	it( 'works for "on" property', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
-		var spy3 = bender.sinon.spy();
-		var spy4 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
+		let spy3 = bender.sinon.spy();
+		let spy4 = bender.sinon.spy();
 
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			children: [
 				{
@@ -156,12 +156,12 @@ describe( 'callback value', function() {
 	} );
 
 	it( 'works for "on" property with selectors', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
-		var spy3 = bender.sinon.spy();
-		var spy4 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
+		let spy3 = bender.sinon.spy();
+		let spy4 = bender.sinon.spy();
 
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			children: [
 				{

+ 19 - 19
packages/ckeditor5-ui/tests/ui/view.js

@@ -10,7 +10,7 @@
 
 const modules = bender.amd.require( 'ckeditor', 'ui/view', 'ui/region', 'ckeditorerror', 'model', 'eventinfo' );
 let View, TestView;
-var view;
+let view;
 
 bender.tools.createSinonSandbox();
 
@@ -56,8 +56,8 @@ describe( 'bind', function() {
 	it( 'returns a function that passes arguments', function() {
 		setTestViewInstance( { a: 'foo' } );
 
-		var spy = bender.sinon.spy();
-		var callback = view.bind( 'a', spy );
+		let spy = bender.sinon.spy();
+		let callback = view.bind( 'a', spy );
 
 		expect( spy.called ).to.be.false;
 
@@ -113,7 +113,7 @@ describe( 'bind', function() {
 	} );
 
 	it( 'allows binding to the model with value processing', function() {
-		var callback = ( el, value ) =>
+		let callback = ( el, value ) =>
 			( value > 0 ? 'positive' : 'negative' );
 
 		setTestViewClass( function() {
@@ -160,7 +160,7 @@ describe( 'bind', function() {
 
 describe( 'on', function() {
 	it( 'accepts plain binding', function() {
-		var spy = bender.sinon.spy();
+		let spy = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -183,8 +183,8 @@ describe( 'on', function() {
 	} );
 
 	it( 'accepts an array of event bindings', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -212,9 +212,9 @@ describe( 'on', function() {
 	} );
 
 	it( 'accepts DOM selectors', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
-		var spy3 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
+		let spy3 = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -297,8 +297,8 @@ describe( 'on', function() {
 	} );
 
 	it( 'accepts function callbacks', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -330,7 +330,7 @@ describe( 'on', function() {
 	} );
 
 	it( 'supports event delegation', function() {
-		var spy = bender.sinon.spy();
+		let spy = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -358,7 +358,7 @@ describe( 'on', function() {
 	} );
 
 	it( 'works for future elements', function() {
-		var spy = bender.sinon.spy();
+		let spy = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -373,7 +373,7 @@ describe( 'on', function() {
 
 		view.on( 'a', spy );
 
-		var div = document.createElement( 'div' );
+		let div = document.createElement( 'div' );
 		view.el.appendChild( div );
 
 		dispatchEvent( div, 'test' );
@@ -405,7 +405,7 @@ describe( 'destroy', function() {
 
 	it( 'detaches the element', function() {
 		// Append the views's element to some container.
-		var container = document.createElement( 'div' );
+		let container = document.createElement( 'div' );
 		container.appendChild( view.el );
 
 		expect( view.el.nodeName ).to.be.equal( 'A' );
@@ -420,8 +420,8 @@ describe( 'destroy', function() {
 
 	it( 'destroys child regions', function() {
 		const Region = modules[ 'ui/region' ];
-		var region = new Region( 'test' );
-		var spy = bender.sinon.spy( region, 'destroy' );
+		let region = new Region( 'test' );
+		let spy = bender.sinon.spy( region, 'destroy' );
 
 		view.regions.add( region );
 		view.destroy();
@@ -441,7 +441,7 @@ describe( 'destroy', function() {
 		setTestViewInstance( { foo: 'bar' } );
 
 		// Keep the reference after the view is destroyed.
-		var model = view.model;
+		let model = view.model;
 
 		expect( view.el.outerHTML ).to.be.equal( '<p>bar</p>' );