Browse Source

Merge pull request #82 from ckeditor/t/80

ES6-y the code
Piotr Jasiun 10 years ago
parent
commit
a15da5b7a2
33 changed files with 550 additions and 546 deletions
  1. 1 0
      packages/ckeditor5-ui/.jshintrc
  2. 2 1
      packages/ckeditor5-ui/dev/.jshintrc
  3. 4 4
      packages/ckeditor5-ui/dev/tasks/jscs.js
  4. 4 4
      packages/ckeditor5-ui/dev/tasks/jshint.js
  5. 19 19
      packages/ckeditor5-ui/dev/tasks/utils/tools.js
  6. 3 3
      packages/ckeditor5-ui/gruntfile.js
  7. 1 1
      packages/ckeditor5-ui/src/ckeditorerror.js
  8. 8 8
      packages/ckeditor5-ui/src/collection.js
  9. 7 7
      packages/ckeditor5-ui/src/config.js
  10. 17 17
      packages/ckeditor5-ui/src/emittermixin.js
  11. 1 1
      packages/ckeditor5-ui/src/eventinfo.js
  12. 2 2
      packages/ckeditor5-ui/src/log.js
  13. 6 6
      packages/ckeditor5-ui/src/model.js
  14. 12 12
      packages/ckeditor5-ui/src/ui/domemittermixin.js
  15. 1 1
      packages/ckeditor5-ui/src/ui/region.js
  16. 8 8
      packages/ckeditor5-ui/src/ui/template.js
  17. 2 2
      packages/ckeditor5-ui/src/ui/view.js
  18. 3 3
      packages/ckeditor5-ui/src/utils-lodash.js
  19. 12 11
      packages/ckeditor5-ui/src/utils.js
  20. 1 0
      packages/ckeditor5-ui/tests/.jshintrc
  21. 4 4
      packages/ckeditor5-ui/tests/_tools/tools.js
  22. 15 15
      packages/ckeditor5-ui/tests/bender/tools.js
  23. 52 52
      packages/ckeditor5-ui/tests/collection/collection.js
  24. 38 38
      packages/ckeditor5-ui/tests/config/config.js
  25. 11 11
      packages/ckeditor5-ui/tests/editorconfig/editorconfig.js
  26. 94 94
      packages/ckeditor5-ui/tests/emittermixin/emittermixin.js
  27. 11 11
      packages/ckeditor5-ui/tests/eventinfo/eventinfo.js
  28. 13 13
      packages/ckeditor5-ui/tests/log/log.js
  29. 31 31
      packages/ckeditor5-ui/tests/mvc/model/model.js
  30. 64 64
      packages/ckeditor5-ui/tests/ui/domemittermixin.js
  31. 20 20
      packages/ckeditor5-ui/tests/ui/region.js
  32. 32 32
      packages/ckeditor5-ui/tests/ui/template.js
  33. 51 51
      packages/ckeditor5-ui/tests/ui/view.js

+ 1 - 0
packages/ckeditor5-ui/.jshintrc

@@ -9,6 +9,7 @@
 	"undef": true,
 	"unused": true,
 	"strict": true,
+	"varstmt": true,
 
 	"globalstrict": true,
 

+ 2 - 1
packages/ckeditor5-ui/dev/.jshintrc

@@ -8,5 +8,6 @@
 	"nonbsp": true,
 	"undef": true,
 	"unused": true,
-	"strict": true
+	"strict": true,
+	"varstmt": true
 }

+ 4 - 4
packages/ckeditor5-ui/dev/tasks/jscs.js

@@ -1,8 +1,8 @@
 'use strict';
 
-var tools = require( './utils/tools' );
+const tools = require( './utils/tools' );
 
-module.exports = function( grunt ) {
+module.exports = ( grunt ) => {
 	tools.setupMultitaskConfig( grunt, {
 		task: 'jscs',
 		defaultOptions: {
@@ -10,11 +10,11 @@ module.exports = function( grunt ) {
 			},
 		addGitIgnore: 'excludeFiles',
 		targets: {
-			all: function() {
+			all() {
 				return [ '**/*.js' ];
 			},
 
-			git: function() {
+			git() {
 				return tools.getGitDirtyFiles().filter( function( file ) {
 					return ( /\.js$/ ).test( file );
 				} );

+ 4 - 4
packages/ckeditor5-ui/dev/tasks/jshint.js

@@ -1,8 +1,8 @@
 'use strict';
 
-var tools = require( './utils/tools' );
+const tools = require( './utils/tools' );
 
-module.exports = function( grunt ) {
+module.exports = ( grunt ) => {
 	tools.setupMultitaskConfig( grunt, {
 		task: 'jshint',
 		defaultOptions: {
@@ -10,11 +10,11 @@ module.exports = function( grunt ) {
 			},
 		addGitIgnore: 'ignores',
 		targets: {
-			all: function() {
+			all() {
 				return [ '**/*.js' ];
 			},
 
-			git: function() {
+			git() {
 				return tools.getGitDirtyFiles().filter( function( file ) {
 					return ( /\.js$/ ).test( file );
 				} );

+ 19 - 19
packages/ckeditor5-ui/dev/tasks/utils/tools.js

@@ -1,6 +1,6 @@
 'use strict';
 
-var dirtyFiles,
+let dirtyFiles,
 	ignoreList;
 
 module.exports = {
@@ -11,15 +11,15 @@ module.exports = {
 	 * @param task {String} The task name. May optionally include the target (e.g. 'task:target').
 	 * @returns {Boolean} "true" if the task is in the queue.
 	 */
-	checkTaskInQueue: function( grunt, task ) {
-		var cliTasks = grunt.cli.tasks;
+	checkTaskInQueue( grunt, task ) {
+		const cliTasks = grunt.cli.tasks;
 
 		// Check if the task has been called directly.
-		var isDirectCall = ( cliTasks.indexOf( task ) > -1 );
+		const isDirectCall = ( cliTasks.indexOf( task ) > -1 );
 		// Check if this is a "default" call and that the task is inside "default".
-		var isDefaultTask = ( cliTasks.indexOf( 'default' ) > -1 ) || !cliTasks.length;
+		const isDefaultTask = ( cliTasks.indexOf( 'default' ) > -1 ) || !cliTasks.length;
 		// Hacking Grunt hard.
-		var isTaskInDefault = isDefaultTask && ( grunt.task._tasks.default.info.indexOf( '"' + task + '"' ) > -1 );
+		const isTaskInDefault = isDefaultTask && ( grunt.task._tasks.default.info.indexOf( '"' + task + '"' ) > -1 );
 
 		return isDirectCall || isTaskInDefault;
 	},
@@ -30,16 +30,16 @@ module.exports = {
 	 * @param grunt {Object} The Grunt object.
 	 * @param options {Object} A list of options for the method. See the jscs and jshint tasks for example.
 	 */
-	setupMultitaskConfig: function( grunt, options ) {
-		var task = options.task;
-		var taskConfig = {};
-		var config = taskConfig[ task ] = {
+	setupMultitaskConfig( grunt, options ) {
+		const task = options.task;
+		const taskConfig = {};
+		const config = taskConfig[ task ] = {
 			options: options.defaultOptions
 		};
 
 		// "all" is the default target to be used if others are not to be run.
-		var all = options.targets.all;
-		var isAll = true;
+		const all = options.targets.all;
+		let isAll = true;
 
 		delete options.targets.all;
 
@@ -56,8 +56,8 @@ module.exports = {
 
 		// Append .gitignore entries to the ignore list.
 		if ( options.addGitIgnore ) {
-			var ignoreProp = task + '.options.' + options.addGitIgnore;
-			var ignores = grunt.config.get( ignoreProp ) || [];
+			let ignoreProp = task + '.options.' + options.addGitIgnore;
+			let ignores = grunt.config.get( ignoreProp ) || [];
 
 			ignores = ignores.concat( this.getGitIgnore( grunt ) );
 			grunt.config.set( ignoreProp, ignores );
@@ -73,7 +73,7 @@ module.exports = {
 	 * @param grunt {Object} The Grunt object.
 	 * @returns {String[]} The list of ignores.
 	 */
-	getGitIgnore: function( grunt ) {
+	getGitIgnore( grunt ) {
 		if ( !ignoreList ) {
 			ignoreList = grunt.file.read( '.gitignore' );
 
@@ -96,7 +96,7 @@ module.exports = {
 	 *
 	 * @returns {String[]} A list of file paths.
 	 */
-	getGitDirtyFiles: function() {
+	getGitDirtyFiles() {
 		// Cache it, so it is executed only once when running multiple tasks.
 		if ( !dirtyFiles ) {
 			dirtyFiles = this
@@ -122,11 +122,11 @@ module.exports = {
 	 * @param command {String} The command to be executed.
 	 * @returns {String} The command output.
 	 */
-	shExec: function( command ) {
-		var sh = require( 'shelljs' );
+	shExec( command ) {
+		const sh = require( 'shelljs' );
 		sh.config.silent = true;
 
-		var ret = sh.exec( command );
+		const ret = sh.exec( command );
 
 		if ( ret.code ) {
 			throw new Error(

+ 3 - 3
packages/ckeditor5-ui/gruntfile.js

@@ -1,13 +1,13 @@
-/* jshint node: true */
+/* jshint node: true, esnext: true, varstmt: true */
 
 'use strict';
 
-module.exports = function( grunt ) {
+module.exports = ( grunt ) => {
 	// First register the "default" task, so it can be analyzed by other tasks.
 	grunt.registerTask( 'default', [ 'jshint:git', 'jscs:git' ] );
 
 	// Files that will be ignored by the "jscs" and "jshint" tasks.
-	var ignoreFiles = [
+	const ignoreFiles = [
 		'src/lib/**',
 		// Automatically loaded from .gitignore. Add more if necessary.
 	];

+ 1 - 1
packages/ckeditor5-ui/src/ckeditorerror.js

@@ -17,7 +17,7 @@
  * @extends Error
  */
 
-CKEDITOR.define( function() {
+CKEDITOR.define( () => {
 	class CKEditorError extends Error {
 		/**
 		 * Creates an instance of the CKEditorError class.

+ 8 - 8
packages/ckeditor5-ui/src/collection.js

@@ -19,7 +19,7 @@
  * @mixins EventEmitter
  */
 
-CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( EmitterMixin, CKEditorError, utils ) {
+CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], ( EmitterMixin, CKEditorError, utils ) => {
 	class Collection {
 		/**
 		 * Creates a new Collection instance.
@@ -81,8 +81,8 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( Emitter
 		 * @param {Object} item
 		 */
 		add( item ) {
-			var itemId;
-			var idProperty = this._idProperty;
+			let itemId;
+			const idProperty = this._idProperty;
 
 			if ( ( idProperty in item ) ) {
 				itemId = item[ idProperty ];
@@ -124,7 +124,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( Emitter
 		 * @returns {Object} The requested item or `null` if such item does not exist.
 		 */
 		get( idOrIndex ) {
-			var item;
+			let item;
 
 			if ( typeof idOrIndex == 'string' ) {
 				item = this._itemMap.get( idOrIndex );
@@ -149,9 +149,9 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( Emitter
 		 * @returns {Object} The removed item.
 		 */
 		remove( subject ) {
-			var index, id, item;
-			var itemDoesNotExist = false;
-			var idProperty = this._idProperty;
+			let index, id, item;
+			let itemDoesNotExist = false;
+			const idProperty = this._idProperty;
 
 			if ( typeof subject == 'string' ) {
 				id = subject;
@@ -245,7 +245,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( Emitter
 		 * @returns {String} The next id.
 		 */
 		_getNextId() {
-			var id;
+			let id;
 
 			do {
 				id = String( this._nextId++ );

+ 7 - 7
packages/ckeditor5-ui/src/config.js

@@ -12,7 +12,7 @@
  * @extends Model
  */
 
-CKEDITOR.define( [ 'model', 'utils' ], function( Model, utils ) {
+CKEDITOR.define( [ 'model', 'utils' ], ( Model, utils ) => {
 	class Config extends Model {
 		/**
 		 * Creates an instance of the {@link Config} class.
@@ -76,17 +76,17 @@ CKEDITOR.define( [ 'model', 'utils' ], function( Model, utils ) {
 
 			// The target for this configuration is, for now, this object.
 			//jscs:disable safeContextKeyword
-			var target = this;
+			let target = this;
 			//jscs:enable
 
 			// The configuration name should be split into parts if it has dots. E.g: `resize.width`.
-			var parts = name.toLowerCase().split( '.' );
+			const parts = name.toLowerCase().split( '.' );
 
 			// Take the name of the configuration out of the parts. E.g. `resize.width` -> `width`
 			name = parts.pop();
 
 			// Retrieves the final target for this configuration recursively.
-			for ( var i = 0; i < parts.length; i++ ) {
+			for ( let i = 0; i < parts.length; i++ ) {
 				// The target will always be an instance of Config.
 				if ( !( target[ parts[ i ] ] instanceof Config ) ) {
 					target.set( parts[ i ], new Config() );
@@ -132,17 +132,17 @@ CKEDITOR.define( [ 'model', 'utils' ], function( Model, utils ) {
 		get( name ) {
 			// The target for this configuration is, for now, this object.
 			//jscs:disable safeContextKeyword
-			var source = this;
+			let source = this;
 			//jscs:enable
 
 			// The configuration name should be split into parts if it has dots. E.g. `resize.width` -> [`resize`, `width`]
-			var parts = name.toLowerCase().split( '.' );
+			const parts = name.toLowerCase().split( '.' );
 
 			// Take the name of the configuration from the parts. E.g. `resize.width` -> `width`
 			name = parts.pop();
 
 			// Retrieves the source for this configuration recursively.
-			for ( var i = 0; i < parts.length; i++ ) {
+			for ( let i = 0; i < parts.length; i++ ) {
 				// The target will always be an instance of Config.
 				if ( !( source[ parts[ i ] ] instanceof Config ) ) {
 					source = null;

+ 17 - 17
packages/ckeditor5-ui/src/emittermixin.js

@@ -12,8 +12,8 @@
  * @singleton
  */
 
-CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
-	var EmitterMixin = {
+CKEDITOR.define( [ 'eventinfo', 'utils' ], ( EventInfo, utils ) => {
+	const EmitterMixin = {
 		/**
 		 * Registers a callback function to be executed when an event is fired.
 		 *
@@ -25,7 +25,7 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 		 * Lower values are called first.
 		 */
 		on( event, callback, ctx, priority ) {
-			var callbacks = getCallbacks( this, event );
+			const callbacks = getCallbacks( this, event );
 
 			// Set the priority defaults.
 			if ( typeof priority != 'number' ) {
@@ -39,7 +39,7 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 			};
 
 			// Add the callback to the list in the right priority position.
-			for ( var i = callbacks.length - 1; i >= 0; i-- ) {
+			for ( let i = callbacks.length - 1; i >= 0; i-- ) {
 				if ( callbacks[ i ].priority <= priority ) {
 					callbacks.splice( i + 1, 0, callback );
 
@@ -62,7 +62,7 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 		 * Lower values are called first.
 		 */
 		once( event, callback, ctx, priority ) {
-			var onceCallback = function( event ) {
+			const onceCallback = function( event ) {
 				// Go off() at the first call.
 				event.off();
 
@@ -83,13 +83,13 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 		 * the same callback is used several times with different contexts.
 		 */
 		off( event, callback, ctx ) {
-			var callbacks = getCallbacksIfAny( this, event );
+			const callbacks = getCallbacksIfAny( this, event );
 
 			if ( !callbacks ) {
 				return;
 			}
 
-			for ( var i = 0; i < callbacks.length; i++ ) {
+			for ( let i = 0; i < callbacks.length; i++ ) {
 				if ( callbacks[ i ].callback == callback ) {
 					if ( !ctx || ctx == callbacks[ i ].ctx ) {
 						// Remove the callback from the list (fixing the next index).
@@ -111,7 +111,7 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 		 * Lower values are called first.
 		 */
 		listenTo( emitter, event, callback, ctx, priority ) {
-			var emitters, emitterId, emitterInfo, eventCallbacks;
+			let emitters, emitterId, emitterInfo, eventCallbacks;
 
 			// _listeningTo contains a list of emitters that this object is listening to.
 			// This list has the following format:
@@ -167,10 +167,10 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 		 * `event`.
 		 */
 		stopListening( emitter, event, callback ) {
-			var emitters = this._listeningTo;
-			var emitterId = emitter && emitter._emitterId;
-			var emitterInfo = emitters && emitterId && emitters[ emitterId ];
-			var eventCallbacks = emitterInfo && event && emitterInfo.callbacks[ event ];
+			let emitters = this._listeningTo;
+			let emitterId = emitter && emitter._emitterId;
+			let emitterInfo = emitters && emitterId && emitters[ emitterId ];
+			let eventCallbacks = emitterInfo && event && emitterInfo.callbacks[ event ];
 
 			// Stop if nothing has been listened.
 			if ( !emitters || ( emitter && !emitterInfo ) || ( event && !eventCallbacks ) ) {
@@ -214,19 +214,19 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 		 * @param {...*} [args] Additional arguments to be passed to the callbacks.
 		 */
 		fire( event, args ) {
-			var callbacks = getCallbacksIfAny( this, event );
+			const callbacks = getCallbacksIfAny( this, event );
 
 			if ( !callbacks ) {
 				return;
 			}
 
-			var eventInfo = new EventInfo( this, event );
+			let eventInfo = new EventInfo( this, event );
 
 			// Take the list of arguments to pass to the callbacks.
 			args = Array.prototype.slice.call( arguments, 1 );
 			args.unshift( eventInfo );
 
-			for ( var i = 0; i < callbacks.length; i++ ) {
+			for ( let i = 0; i < callbacks.length; i++ ) {
 				callbacks[ i ].callback.apply( callbacks[ i ].ctx, args );
 
 				// Remove the callback from future requests if off() has been called.
@@ -262,7 +262,7 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 
 	// Gets the list of callbacks for a given event.
 	function getCallbacks( source, eventName ) {
-		var events = getEvents( source );
+		const events = getEvents( source );
 
 		if ( !events[ eventName ] ) {
 			events[ eventName ] = [];
@@ -273,7 +273,7 @@ CKEDITOR.define( [ 'eventinfo', 'utils' ], function( EventInfo, utils ) {
 
 	// Get the list of callbacks for a given event only if there is any available.
 	function getCallbacksIfAny( source, event ) {
-		var callbacks;
+		let callbacks;
 
 		if ( !source._events || !( callbacks = source._events[ event ] ) || !callbacks.length ) {
 			return null;

+ 1 - 1
packages/ckeditor5-ui/src/eventinfo.js

@@ -12,7 +12,7 @@
  * @class EventInfo
  */
 
-CKEDITOR.define( [ 'utils' ], function( utils ) {
+CKEDITOR.define( [ 'utils' ], ( utils ) => {
 	class EventInfo {
 		constructor( source, name ) {
 			/**

+ 2 - 2
packages/ckeditor5-ui/src/log.js

@@ -39,8 +39,8 @@
  * @singleton
  */
 
-CKEDITOR.define( function() {
-	var log = {
+CKEDITOR.define( () => {
+	const log = {
 		/**
 		 * Logs an error to the console.
 		 *

+ 6 - 6
packages/ckeditor5-ui/src/model.js

@@ -12,7 +12,7 @@
  * @mixins EventEmitter
  */
 
-CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( EmitterMixin, CKEditorError, utils ) {
+CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], ( EmitterMixin, CKEditorError, utils ) => {
 	class Model {
 		/**
 		 * Creates a new Model instance.
@@ -57,7 +57,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( Emitter
 		set( name, value ) {
 			// If the first parameter is an Object, we gonna interact through its properties.
 			if ( utils.isObject( name ) ) {
-				Object.keys( name ).forEach( function( attr ) {
+				Object.keys( name ).forEach( ( attr ) => {
 					this.set( attr, name[ attr ] );
 				}, this );
 
@@ -71,7 +71,7 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( Emitter
 				 * This error is thrown when trying to {@link Model#set set} an attribute with
 				 * a name of an already existing property. For example:
 				 *
-				 *		var model = new Model();
+				 *		let model = new Model();
 				 *		model.property = 1;
 				 *		model.set( 'property', 2 );		// throws
 				 *
@@ -87,12 +87,12 @@ CKEDITOR.define( [ 'emittermixin', 'ckeditorerror', 'utils' ], function( Emitter
 				enumerable: true,
 				configurable: true,
 
-				get: function() {
+				get: () => {
 					return this._attributes[ name ];
 				},
 
-				set: function( value ) {
-					var oldValue = this._attributes[ name ];
+				set: ( value ) => {
+					const oldValue = this._attributes[ name ];
 
 					if ( oldValue !== value ) {
 						this._attributes[ name ] = value;

+ 12 - 12
packages/ckeditor5-ui/src/ui/domemittermixin.js

@@ -36,8 +36,8 @@
  * @singleton
  */
 
-CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, utils, log ) {
-	var DOMEmitterMixin = {
+CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], ( EmitterMixin, utils, log ) => {
+	const DOMEmitterMixin = {
 		/**
 		 * Registers a callback function to be executed when an event is fired in a specific Emitter or DOM Node.
 		 * It is backwards compatible with {@link EmitterMixin#listenTo}.
@@ -50,8 +50,8 @@ CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, uti
 		 * Lower values are called first.
 		 */
 		listenTo() {
-			var args = Array.prototype.slice.call( arguments );
-			var emitter = args[ 0 ];
+			const args = Array.prototype.slice.call( arguments );
+			const emitter = args[ 0 ];
 
 			// Check if emitter is an instance of DOM Node. If so, replace the argument with
 			// corresponding ProxyEmitter (or create one if not existing).
@@ -79,12 +79,12 @@ CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, uti
 		 * `event`.
 		 */
 		stopListening() {
-			var args = Array.prototype.slice.call( arguments );
-			var emitter = args[ 0 ];
+			const args = Array.prototype.slice.call( arguments );
+			const emitter = args[ 0 ];
 
 			// Check if emitter is an instance of DOM Node. If so, replace the argument with corresponding ProxyEmitter.
 			if ( emitter instanceof Node ) {
-				var proxy = this._getProxyEmitter( emitter );
+				let proxy = this._getProxyEmitter( emitter );
 
 				if ( proxy ) {
 					args[ 0 ] = proxy;
@@ -107,10 +107,10 @@ CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, uti
 		 * @return {ProxyEmitter} ProxyEmitter instance or null.
 		 */
 		_getProxyEmitter( node ) {
-			var proxy, emitters, emitterInfo;
+			let proxy, emitters, emitterInfo;
 
 			// Get node UID. It allows finding Proxy Emitter for this DOM Node.
-			var uid = getNodeUID( node );
+			const uid = getNodeUID( node );
 
 			// Find existing Proxy Emitter for this DOM Node among emitters.
 			if ( ( emitters = this._listeningTo ) ) {
@@ -172,7 +172,7 @@ CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, uti
 				return;
 			}
 
-			var domListener = this._createDomListener( event );
+			const domListener = this._createDomListener( event );
 
 			// Attach the native DOM listener to DOM Node.
 			this._domNode.addEventListener( event, domListener );
@@ -198,7 +198,7 @@ CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, uti
 			// Execute parent class method first.
 			EmitterMixin.off.apply( this, arguments );
 
-			var callbacks;
+			let callbacks;
 
 			// Remove native DOM listeners which are orphans. If no callbacks
 			// are awaiting given event, detach native DOM listener from DOM Node.
@@ -217,7 +217,7 @@ CKEDITOR.define( [ 'emittermixin', 'utils', 'log' ], function( EmitterMixin, uti
 		 * @returns {Function} The DOM listener callback.
 		 */
 		_createDomListener( event ) {
-			var domListener = domEvt => {
+			const domListener = domEvt => {
 				this.fire( event, domEvt );
 			};
 

+ 1 - 1
packages/ckeditor5-ui/src/ui/region.js

@@ -12,7 +12,7 @@
  * @extends Model
  */
 
-CKEDITOR.define( [ 'collection', 'model' ], function( Collection, Model ) {
+CKEDITOR.define( [ 'collection', 'model' ], ( Collection, Model ) => {
 	class Region extends Model {
 		/**
 		 * Creates an instance of the {@link Region} class.

+ 8 - 8
packages/ckeditor5-ui/src/ui/template.js

@@ -13,7 +13,7 @@
  * @class Template
  */
 
-CKEDITOR.define( function() {
+CKEDITOR.define( () => {
 	class Template {
 		/**
 		 * Creates an instance of the {@link Template} class.
@@ -53,7 +53,7 @@ CKEDITOR.define( function() {
 			return null;
 		}
 
-		var el = document.createElement( def.tag );
+		const el = document.createElement( def.tag );
 
 		// Set the text first.
 		renderElementText( def, el );
@@ -81,8 +81,8 @@ CKEDITOR.define( function() {
 	}
 
 	function renderElementAttributes( def, el ) {
-		var value;
-		var attr;
+		let value;
+		let attr;
 
 		for ( attr in def.attrs ) {
 			value = def.attrs[ attr ];
@@ -105,7 +105,7 @@ CKEDITOR.define( function() {
 	}
 
 	function renderElementChildren( def, el ) {
-		var child;
+		let child;
 
 		if ( def.children ) {
 			for ( child of def.children ) {
@@ -116,9 +116,9 @@ CKEDITOR.define( function() {
 
 	function activateElementListeners( def, el ) {
 		if ( def.on ) {
-			for ( var l in def.on ) {
-				var domEvtDef = l.split( '@' );
-				var name, selector;
+			for ( let l in def.on ) {
+				let domEvtDef = l.split( '@' );
+				let name, selector;
 
 				if ( domEvtDef.length == 2 ) {
 					name = domEvtDef[ 0 ];

+ 2 - 2
packages/ckeditor5-ui/src/ui/view.js

@@ -20,7 +20,7 @@ CKEDITOR.define( [
 	'ckeditorerror',
 	'ui/domemittermixin',
 	'utils'
-], function( Collection, Model, Template, CKEditorError, DOMEmitterMixin, utils ) {
+], ( Collection, Model, Template, CKEditorError, DOMEmitterMixin, utils ) => {
 	class View extends Model {
 		/**
 		 * Creates an instance of the {@link View} class.
@@ -95,7 +95,7 @@ CKEDITOR.define( [
 				onModelChange( null, this.model[ property ] );
 
 				function onModelChange( evt, value ) {
-					var processedValue = callback( el, value );
+					let processedValue = callback( el, value );
 
 					if ( typeof processedValue != 'undefined' ) {
 						domUpdater( el, processedValue );

+ 3 - 3
packages/ckeditor5-ui/src/utils-lodash.js

@@ -13,10 +13,10 @@
 //
 // https://lodash.com/docs
 
-( function() {
+( () => {
 	// The list of Lo-Dash methods to include in "utils".
 	// It is mandatory to execute `grunt lodash` after changes to this list.
-	var lodashInclude = [
+	const lodashInclude = [
 		/**
 		 * See Lo-Dash: https://lodash.com/docs#clone
 		 *
@@ -79,7 +79,7 @@
 	if ( typeof module == 'object' && module.exports ) {
 		module.exports = lodashInclude;
 	} else {
-		CKEDITOR.define( function() {
+		CKEDITOR.define( () => {
 			return lodashInclude;
 		} );
 	}

+ 12 - 11
packages/ckeditor5-ui/src/utils.js

@@ -12,8 +12,8 @@
  * @singleton
  */
 
-CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], function( lodashIncludes, lodash ) {
-	var utils = {
+CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], ( lodashIncludes, lodash ) => {
+	const utils = {
 		/**
 		 * Creates a spy function (ala Sinon.js) that can be used to inspect call to it.
 		 *
@@ -24,11 +24,9 @@ CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], function( lod
 		 * @returns {Function} The spy function.
 		 */
 		spy() {
-			var spy = function() {
+			return function spy() {
 				spy.called = true;
 			};
-
-			return spy;
 		},
 
 		/**
@@ -37,10 +35,10 @@ CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], function( lod
 		 *
 		 * @returns {Number} A number representing the id.
 		 */
-		uid: ( function() {
-			var next = 1;
+		uid: ( () => {
+			let next = 1;
 
-			return function() {
+			return () => {
 				return next++;
 			};
 		} )(),
@@ -71,9 +69,9 @@ CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], function( lod
 		 * `a` is a {@link utils.compareArrays#EXTENSION extension}, or `a` is {@link utils.compareArrays#DIFFERENT different}.
 		 */
 		compareArrays( a, b ) {
-			var minLen = Math.min( a.length, b.length );
+			const minLen = Math.min( a.length, b.length );
 
-			for ( var i = 0; i < minLen; i++ ) {
+			for ( let i = 0; i < minLen; i++ ) {
 				if ( a[ i ] != b[ i ] ) {
 					// The arrays are different.
 					return utils.compareArrays.DIFFERENT;
@@ -100,18 +98,21 @@ CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], function( lod
 	 * @type {Number}
 	 */
 	utils.compareArrays.SAME = 0;
+
 	/**
 	 * Flag for "is a prefix of" relation between arrays.
 	 *
 	 * @type {Number}
 	 */
 	utils.compareArrays.PREFIX = 1;
+
 	/**
 	 * Flag for "is a suffix of" relation between arrays.
 	 *
 	 * @type {number}
 	 */
 	utils.compareArrays.EXTENSION = 2;
+
 	/**
 	 * Flag for "is different than" relation between arrays.
 	 *
@@ -120,7 +121,7 @@ CKEDITOR.define( [ 'utils-lodash', 'lib/lodash/lodash-ckeditor' ], function( lod
 	utils.compareArrays.DIFFERENT = 3;
 
 	// Extend "utils" with Lo-Dash methods.
-	for ( var i = 0; i < lodashIncludes.length; i++ ) {
+	for ( let i = 0; i < lodashIncludes.length; i++ ) {
 		utils[ lodashIncludes[ i ] ] = lodash[ lodashIncludes[ i ] ];
 	}
 

+ 1 - 0
packages/ckeditor5-ui/tests/.jshintrc

@@ -10,6 +10,7 @@
 	"unused": true,
 	"strict": true,
 	"expr": true,
+	"varstmt": true,
 
 	"globalstrict": true,
 

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

@@ -5,7 +5,7 @@
 
 'use strict';
 
-( function() {
+( () => {
 	bender.tools.core = {
 		/**
 		 * Defines CKEditor plugin which is a mock of an editor creator.
@@ -23,8 +23,8 @@
 		 * @param {Object} [proto] Prototype of the creator. Properties from the proto param will
 		 * be copied to the prototype of the creator.
 		 */
-		defineEditorCreatorMock: function( creatorName, proto ) {
-			CKEDITOR.define( 'plugin!creator-' + creatorName, [ 'creator' ], function( Creator ) {
+		defineEditorCreatorMock: ( creatorName, proto ) => {
+			CKEDITOR.define( 'plugin!creator-' + creatorName, [ 'creator' ], ( Creator ) => {
 				return mockCreator( Creator );
 			} );
 
@@ -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 ];
 					}
 				}

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

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

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

@@ -5,7 +5,7 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'collection', 'ckeditorerror' );
+const modules = bender.amd.require( 'collection', 'ckeditorerror' );
 
 bender.tools.createSinonSandbox();
 
@@ -16,14 +16,14 @@ function getItem( id, idProperty ) {
 }
 
 describe( 'Collection', () => {
-	var Collection, CKEditorError;
+	let Collection, CKEditorError;
 
 	before( () => {
 		Collection = modules.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 );

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

@@ -5,12 +5,12 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'config' );
+const modules = bender.amd.require( 'config' );
 
-var config;
+let config;
 
-beforeEach( function() {
-	var Config = modules.config;
+beforeEach( () => {
+	const Config = modules.config;
 
 	config = new Config( {
 		creator: 'inline',
@@ -26,8 +26,8 @@ beforeEach( function() {
 	} );
 } );
 
-describe( 'constructor', function() {
-	it( 'should set configurations', function() {
+describe( 'constructor', () => {
+	it( 'should set configurations', () => {
 		expect( config ).to.have.property( 'creator' ).to.equal( 'inline' );
 		expect( config ).to.have.property( 'language' ).to.equal( 'pl' );
 		expect( config ).to.have.property( 'resize' ).to.have.property( 'minheight' ).to.equal( 300 );
@@ -37,23 +37,23 @@ describe( 'constructor', function() {
 		expect( config ).to.have.property( 'toolbar' ).to.equal( 'top' );
 	} );
 
-	it( 'should work with no parameters', function() {
-		var Config = modules.config;
+	it( 'should work with no parameters', () => {
+		const Config = modules.config;
 
 		// No error should be thrown.
 		config = new Config();
 	} );
 } );
 
-describe( 'set', function() {
-	it( 'should create Config instances for objects', function() {
-		var Config = modules.config;
+describe( 'set', () => {
+	it( 'should create Config instances for objects', () => {
+		const Config = modules.config;
 
 		expect( config.resize ).to.be.an.instanceof( Config );
 		expect( config.resize.icon ).to.be.an.instanceof( Config );
 	} );
 
-	it( 'should set configurations when passing objects', function() {
+	it( 'should set configurations when passing objects', () => {
 		config.set( {
 			option1: 1,
 			option2: {
@@ -69,13 +69,13 @@ describe( 'set', function() {
 			.to.have.property( 'suboption21' ).to.equal( 21 );
 	} );
 
-	it( 'should set configurations when passing name and value', function() {
+	it( 'should set configurations when passing name and value', () => {
 		config.set( 'something', 'anything' );
 
 		expect( config ).to.have.property( 'something' ).to.equal( 'anything' );
 	} );
 
-	it( 'should set configurations when passing name.with.deep and value', function() {
+	it( 'should set configurations when passing name.with.deep and value', () => {
 		config.set( 'color.red', 'f00' );
 		config.set( 'background.color.blue', '00f' );
 
@@ -89,7 +89,7 @@ describe( 'set', function() {
 			.to.have.property( 'blue' ).to.equal( '00f' );
 	} );
 
-	it( 'should override and expand deep configurations', function() {
+	it( 'should override and expand deep configurations', () => {
 		config.set( {
 			resize: {
 				minHeight: 400,		// Override
@@ -111,8 +111,8 @@ describe( 'set', function() {
 		expect( config.resize.icon ).to.have.property( 'url' ).to.equal( true );
 	} );
 
-	it( 'should replace a simple entry with a Config instance', function() {
-		var Config = modules.config;
+	it( 'should replace a simple entry with a Config instance', () => {
+		const Config = modules.config;
 
 		config.set( 'test', 1 );
 		config.set( 'test', {
@@ -123,8 +123,8 @@ describe( 'set', function() {
 		expect( config.test.prop ).to.equal( 1 );
 	} );
 
-	it( 'should replace a simple entry with a Config instance when passing an object', function() {
-		var Config = modules.config;
+	it( 'should replace a simple entry with a Config instance when passing an object', () => {
+		const Config = modules.config;
 
 		config.set( 'test', 1 );
 		config.set( {
@@ -137,8 +137,8 @@ describe( 'set', function() {
 		expect( config.test.prop ).to.equal( 1 );
 	} );
 
-	it( 'should replace a simple entry with a Config instance when passing a name.with.deep', function() {
-		var Config = modules.config;
+	it( 'should replace a simple entry with a Config instance when passing a name.with.deep', () => {
+		const Config = modules.config;
 
 		config.set( 'test.prop', 1 );
 		config.set( 'test.prop.value', 1 );
@@ -148,7 +148,7 @@ describe( 'set', function() {
 		expect( config.test.prop.value ).to.equal( 1 );
 	} );
 
-	it( 'should not create Config instances for non-pure objects', function() {
+	it( 'should not create Config instances for non-pure objects', () => {
 		function SomeClass() {}
 
 		config.set( 'date', new Date() );
@@ -160,7 +160,7 @@ describe( 'set', function() {
 		expect( config.instance ).to.be.an.instanceof( SomeClass );
 	} );
 
-	it( 'should set `null` for undefined value', function() {
+	it( 'should set `null` for undefined value', () => {
 		config.set( 'test' );
 
 		expect( config.test ).to.be.null();
@@ -168,46 +168,46 @@ describe( 'set', function() {
 	} );
 } );
 
-describe( 'get', function() {
-	it( 'should retrieve a configuration', function() {
+describe( 'get', () => {
+	it( 'should retrieve a configuration', () => {
 		expect( config.get( 'creator' ) ).to.equal( 'inline' );
 	} );
 
-	it( 'should retrieve a deep configuration', function() {
+	it( 'should retrieve a deep configuration', () => {
 		expect( config.get( 'resize.minheight' ) ).to.equal( 300 );
 		expect( config.get( 'resize.icon.path' ) ).to.equal( 'xyz' );
 	} );
 
-	it( 'should retrieve a subset of the configuration', function() {
-		var resizeConfig = config.get( 'resize' );
+	it( 'should retrieve a subset of the configuration', () => {
+		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' );
 	} );
 
-	it( 'should retrieve values case-insensitively', function() {
+	it( 'should retrieve values case-insensitively', () => {
 		expect( config.get( 'Creator' ) ).to.equal( 'inline' );
 		expect( config.get( 'CREATOR' ) ).to.equal( 'inline' );
 		expect( config.get( 'resize.minHeight' ) ).to.equal( 300 );
 		expect( config.get( 'resize.MINHEIGHT' ) ).to.equal( 300 );
 	} );
 
-	it( 'should return undefined for non existing configuration', function() {
+	it( 'should return undefined for non existing configuration', () => {
 		expect( config.get( 'invalid' ) ).to.be.undefined();
 	} );
 
-	it( 'should return undefined for non existing deep configuration', function() {
+	it( 'should return undefined for non existing deep configuration', () => {
 		expect( config.get( 'resize.invalid.value' ) ).to.be.undefined();
 	} );
 } );
 
-describe( 'define', function() {
-	it( 'should create the definition property', function() {
+describe( 'define', () => {
+	it( 'should create the definition property', () => {
 		expect( config ).to.not.have.property( 'definition' );
 
 		config.define( 'test', 1 );
@@ -215,7 +215,7 @@ describe( 'define', function() {
 		expect( config ).to.have.property( 'definition' );
 	} );
 
-	it( 'should set configurations in the definition property', function() {
+	it( 'should set configurations in the definition property', () => {
 		config.define( 'test1', 1 );
 
 		// This is for Code Coverage to ensure that it works when `definition` is already defined.
@@ -225,7 +225,7 @@ describe( 'define', function() {
 		expect( config.definition ).to.have.property( 'test2' ).to.equal( 2 );
 	} );
 
-	it( 'should set configurations passed as object in the definition property', function() {
+	it( 'should set configurations passed as object in the definition property', () => {
 		config.define( {
 			test: 1
 		} );
@@ -233,14 +233,14 @@ describe( 'define', function() {
 		expect( config.definition ).to.have.property( 'test' ).to.equal( 1 );
 	} );
 
-	it( 'should not define main config properties but still be retrieved with get()', function() {
+	it( 'should not define main config properties but still be retrieved with get()', () => {
 		config.define( 'test', 1 );
 
 		expect( config ).to.not.have.property( 'test' );
 		expect( config.get( 'test' ) ).to.equal( 1 );
 	} );
 
-	it( 'should be overridden by set()', function() {
+	it( 'should be overridden by set()', () => {
 		config.define( 'test', 1 );
 		config.set( 'test', 2 );
 

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

@@ -5,31 +5,31 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'editorconfig', 'ckeditor' );
+const modules = bender.amd.require( 'editorconfig', 'ckeditor' );
 
-var config;
+let config;
 
-beforeEach( function() {
-	var EditorConfig = modules.editorconfig;
+beforeEach( () => {
+	const EditorConfig = modules.editorconfig;
 
 	config = new EditorConfig( {
 		test: 1
 	} );
 } );
 
-describe( 'constructor', function() {
-	it( 'should set configurations', function() {
+describe( 'constructor', () => {
+	it( 'should set configurations', () => {
 		expect( config ).to.have.property( 'test' ).to.equal( 1 );
 	} );
 } );
 
-describe( 'get', function() {
-	it( 'should retrieve a configuration', function() {
+describe( 'get', () => {
+	it( 'should retrieve a configuration', () => {
 		expect( config.get( 'test' ) ).to.equal( 1 );
 	} );
 
-	it( 'should fallback to CKEDITOR.config', function() {
-		var CKEDITOR = modules.ckeditor;
+	it( 'should fallback to CKEDITOR.config', () => {
+		const CKEDITOR = modules.ckeditor;
 
 		CKEDITOR.config.set( {
 			globalConfig: 2
@@ -38,7 +38,7 @@ describe( 'get', function() {
 		expect( config.get( 'globalConfig' ) ).to.equal( 2 );
 	} );
 
-	it( 'should return undefined for non existing configuration', function() {
+	it( 'should return undefined for non existing configuration', () => {
 		expect( config.get( 'invalid' ) ).to.be.undefined();
 	} );
 } );

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

@@ -5,17 +5,17 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'emittermixin', 'eventinfo', 'utils' );
+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 );
+describe( 'fire', () => {
+	it( 'should execute callbacks in the right order without priority', () => {
+		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 );
@@ -26,12 +26,12 @@ describe( 'fire', function() {
 		sinon.assert.callOrder( spy1, spy2, spy3 );
 	} );
 
-	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 );
+	it( 'should execute callbacks in the right order with priority defined', () => {
+		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.
@@ -44,11 +44,11 @@ describe( 'fire', function() {
 		sinon.assert.callOrder( spy1, spy2, spy3, spy4, spy5 );
 	} );
 
-	it( 'should pass arguments to callbacks', function() {
-		var EventInfo = modules.eventinfo;
+	it( 'should pass arguments to callbacks', () => {
+		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 );
@@ -59,13 +59,13 @@ describe( 'fire', function() {
 		sinon.assert.calledWithExactly( spy2, sinon.match.instanceOf( EventInfo ), 1, 'b', true );
 	} );
 
-	it( 'should pass proper context to callbacks', function() {
-		var ctx1 = {};
-		var ctx2 = {};
+	it( 'should pass proper context to callbacks', () => {
+		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 );
@@ -78,9 +78,9 @@ describe( 'fire', function() {
 		sinon.assert.calledOn( spy3, emitter );
 	} );
 
-	it( 'should fire the right event', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+	it( 'should fire the right event', () => {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 		emitter.on( '1', spy1 );
 		emitter.on( '2', spy2 );
@@ -91,8 +91,8 @@ describe( 'fire', function() {
 		sinon.assert.called( spy2 );
 	} );
 
-	it( 'should execute callbacks many times', function() {
-		var spy = sinon.spy();
+	it( 'should execute callbacks many times', () => {
+		let spy = sinon.spy();
 
 		emitter.on( 'test', spy );
 
@@ -103,12 +103,12 @@ describe( 'fire', function() {
 		sinon.assert.calledThrice( spy );
 	} );
 
-	it( 'should do nothing for a non listened event', function() {
+	it( 'should do nothing for a non listened event', () => {
 		emitter.fire( 'test' );
 	} );
 
-	it( 'should accept the same callback many times', function() {
-		var spy = sinon.spy();
+	it( 'should accept the same callback many times', () => {
+		let spy = sinon.spy();
 
 		emitter.on( 'test', spy );
 		emitter.on( 'test', spy );
@@ -120,11 +120,11 @@ describe( 'fire', function() {
 	} );
 } );
 
-describe( 'on', function() {
-	it( 'should stop()', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
-		var spy3 = sinon.spy( function( event ) {
+describe( 'on', () => {
+	it( 'should stop()', () => {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
+		let spy3 = sinon.spy( ( event ) => {
 			event.stop();
 		} );
 
@@ -141,12 +141,12 @@ describe( 'on', function() {
 		sinon.assert.called( spy3 );
 	} );
 
-	it( 'should take a callback off()', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy( function( event ) {
+	it( 'should take a callback off()', () => {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy( ( event ) => {
 			event.off();
 		} );
-		var spy3 = sinon.spy();
+		let spy3 = sinon.spy();
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
@@ -160,12 +160,12 @@ describe( 'on', function() {
 		sinon.assert.calledTwice( spy3 );
 	} );
 
-	it( 'should take the callback off() even after stop()', function() {
-		var spy1 = sinon.spy( function( event ) {
+	it( 'should take the callback off() even after stop()', () => {
+		let spy1 = sinon.spy( ( event ) => {
 			event.stop();
 			event.off();
 		} );
-		var spy2 = sinon.spy();
+		let spy2 = sinon.spy();
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
@@ -178,11 +178,11 @@ 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();
+describe( 'once', () => {
+	it( 'should be called just once', () => {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
+		let spy3 = sinon.spy();
 
 		emitter.on( 'test', spy1 );
 		emitter.once( 'test', spy2 );
@@ -196,11 +196,11 @@ describe( 'once', function() {
 		sinon.assert.calledTwice( spy3 );
 	} );
 
-	it( 'should have proper scope', function() {
-		var ctx = {};
+	it( 'should have proper scope', () => {
+		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 );
@@ -211,10 +211,10 @@ describe( 'once', function() {
 		sinon.assert.calledOn( spy2, emitter );
 	} );
 
-	it( 'should have proper arguments', function() {
-		var EventInfo = modules.eventinfo;
+	it( 'should have proper arguments', () => {
+		const EventInfo = modules.eventinfo;
 
-		var spy = sinon.spy();
+		let spy = sinon.spy();
 
 		emitter.once( 'test', spy );
 
@@ -224,11 +224,11 @@ describe( 'once', function() {
 	} );
 } );
 
-describe( 'off', function() {
-	it( 'should get callbacks off()', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
-		var spy3 = sinon.spy();
+describe( 'off', () => {
+	it( 'should get callbacks off()', () => {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
+		let spy3 = sinon.spy();
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
@@ -246,13 +246,13 @@ describe( 'off', function() {
 		sinon.assert.calledThrice( spy3 );
 	} );
 
-	it( 'should not fail with unknown events', function() {
-		emitter.off( 'test', function() {} );
+	it( 'should not fail with unknown events', () => {
+		emitter.off( 'test', () => {} );
 	} );
 
-	it( 'should remove all entries for the same callback', function() {
-		var spy1 = sinon.spy().named( 1 );
-		var spy2 = sinon.spy().named( 2 );
+	it( 'should remove all entries for the same callback', () => {
+		let spy1 = sinon.spy().named( 1 );
+		let spy2 = sinon.spy().named( 2 );
 
 		emitter.on( 'test', spy1 );
 		emitter.on( 'test', spy2 );
@@ -269,11 +269,11 @@ describe( 'off', function() {
 		sinon.assert.callCount( spy2, 4 );
 	} );
 
-	it( 'should remove the callback for a specific context only', function() {
-		var spy = sinon.spy().named( 1 );
+	it( 'should remove the callback for a specific context only', () => {
+		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 );
@@ -291,11 +291,11 @@ describe( 'off', function() {
 	} );
 } );
 
-describe( 'listenTo', function() {
+describe( 'listenTo', () => {
 	beforeEach( refreshListener );
 
-	it( 'should properly register callbacks', function() {
-		var spy = sinon.spy();
+	it( 'should properly register callbacks', () => {
+		let spy = sinon.spy();
 
 		listener.listenTo( emitter, 'test', spy );
 
@@ -305,12 +305,12 @@ describe( 'listenTo', function() {
 	} );
 } );
 
-describe( 'stopListening', function() {
+describe( 'stopListening', () => {
 	beforeEach( refreshListener );
 
-	it( 'should stop listening to a specific event callback', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+	it( 'should stop listening to a specific event callback', () => {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 		listener.listenTo( emitter, 'event1', spy1 );
 		listener.listenTo( emitter, 'event2', spy2 );
@@ -327,10 +327,10 @@ describe( 'stopListening', function() {
 		sinon.assert.calledTwice( spy2 );
 	} );
 
-	it( 'should stop listening to an specific event', function() {
-		var spy1a = sinon.spy();
-		var spy1b = sinon.spy();
-		var spy2 = sinon.spy();
+	it( 'should stop listening to an specific event', () => {
+		let spy1a = sinon.spy();
+		let spy1b = sinon.spy();
+		let spy2 = sinon.spy();
 
 		listener.listenTo( emitter, 'event1', spy1a );
 		listener.listenTo( emitter, 'event1', spy1b );
@@ -349,9 +349,9 @@ describe( 'stopListening', function() {
 		sinon.assert.calledTwice( spy2 );
 	} );
 
-	it( 'should stop listening to all events from a specific emitter', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+	it( 'should stop listening to all events from a specific emitter', () => {
+		let spy1 = sinon.spy();
+		let spy2 = sinon.spy();
 
 		listener.listenTo( emitter, 'event1', spy1 );
 		listener.listenTo( emitter, 'event2', spy2 );
@@ -368,12 +368,12 @@ describe( 'stopListening', function() {
 		sinon.assert.calledOnce( spy2 );
 	} );
 
-	it( 'should stop listening to everything', function() {
-		var spy1 = sinon.spy();
-		var spy2 = sinon.spy();
+	it( 'should stop listening to everything', () => {
+		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 );
@@ -394,11 +394,11 @@ describe( 'stopListening', function() {
 		expect( listener ).to.not.have.property( '_listeningTo' );
 	} );
 
-	it( 'should not stop other emitters when a non-listened emitter is provided', function() {
-		var spy = sinon.spy();
+	it( 'should not stop other emitters when a non-listened emitter is provided', () => {
+		let spy = sinon.spy();
 
-		var emitter1 = getEmitterInstance();
-		var emitter2 = getEmitterInstance();
+		let emitter1 = getEmitterInstance();
+		let emitter2 = getEmitterInstance();
 
 		listener.listenTo( emitter1, 'test', spy );
 
@@ -419,8 +419,8 @@ function refreshListener() {
 }
 
 function getEmitterInstance() {
-	var EmitterMixin = modules.emittermixin;
-	var utils = modules.utils;
+	const EmitterMixin = modules.emittermixin;
+	let utils = modules.utils;
 
 	return utils.extend( {}, EmitterMixin );
 }

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

@@ -5,13 +5,13 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'eventinfo' );
+const modules = bender.amd.require( 'eventinfo' );
 
-describe( 'EventInfo', function() {
-	it( 'should be created properly', function() {
-		var EventInfo = modules.eventinfo;
+describe( 'EventInfo', () => {
+	it( 'should be created properly', () => {
+		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' );
@@ -19,10 +19,10 @@ describe( 'EventInfo', function() {
 		expect( event.off.called ).to.not.be.true();
 	} );
 
-	it( 'should have stop() and off() marked', function() {
-		var EventInfo = modules.eventinfo;
+	it( 'should have stop() and off() marked', () => {
+		const EventInfo = modules.eventinfo;
 
-		var event = new EventInfo( this, 'test' );
+		let event = new EventInfo( this, 'test' );
 
 		event.stop();
 		event.off();
@@ -31,10 +31,10 @@ describe( 'EventInfo', function() {
 		expect( event.off.called ).to.be.true();
 	} );
 
-	it( 'should not mark "called" in future instances', function() {
-		var EventInfo = modules.eventinfo;
+	it( 'should not mark "called" in future instances', () => {
+		const EventInfo = modules.eventinfo;
 
-		var event = new EventInfo( this, 'test' );
+		let event = new EventInfo( this, 'test' );
 
 		event.stop();
 		event.off();

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

@@ -7,20 +7,20 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'log' );
-var spy;
+const modules = bender.amd.require( 'log' );
+let spy;
 
-beforeEach( function() {
+beforeEach( () => {
 	if ( spy ) {
 		spy.restore();
 	}
 } );
 
-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 };
+describe( 'warn()', () => {
+	it( 'logs the message to the console using console.warn()', () => {
+		let log = modules.log;
+		let spy = sinon.stub( console, 'warn' );
+		let data = { bar: 1 };
 
 		log.warn( 'foo', data );
 
@@ -33,11 +33,11 @@ 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 };
+describe( 'error()', () => {
+	it( 'logs the message to the console using console.error()', () => {
+		let log = modules.log;
+		let spy = sinon.stub( console, 'error' );
+		let data = { bar: 1 };
 
 		log.error( 'foo', data );
 

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

@@ -5,13 +5,13 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'model', 'eventinfo', 'ckeditorerror' );
+const modules = bender.amd.require( 'model', 'eventinfo', 'ckeditorerror' );
 
-var Car, car;
+let Car, car;
 
-describe( 'Model', function() {
-	beforeEach( 'Create a test model instance', function() {
-		var Model = modules.model;
+describe( 'Model', () => {
+	beforeEach( 'Create a test model instance', () => {
+		const Model = modules.model;
 
 		Car = class extends Model {};
 
@@ -23,28 +23,28 @@ describe( 'Model', function() {
 
 	//////////
 
-	it( 'should set _attributes on creation', function() {
+	it( 'should set _attributes on creation', () => {
 		expect( car._attributes ).to.deep.equal( {
 			color: 'red',
 			year: 2015
 		} );
 	} );
 
-	it( 'should get correctly after set', function() {
+	it( 'should get correctly after set', () => {
 		car.color = 'blue';
 
 		expect( car.color ).to.equal( 'blue' );
 		expect( car._attributes.color ).to.equal( 'blue' );
 	} );
 
-	it( 'should get correctly after setting _attributes', function() {
+	it( 'should get correctly after setting _attributes', () => {
 		car._attributes.color = 'blue';
 
 		expect( car.color ).to.equal( 'blue' );
 	} );
 
-	it( 'should add properties on creation', function() {
-		var car = new Car( null, {
+	it( 'should add properties on creation', () => {
+		let car = new Car( null, {
 			prop: 1
 		} );
 
@@ -53,8 +53,8 @@ describe( 'Model', function() {
 
 	//////////
 
-	describe( 'set', function() {
-		it( 'should work when passing an object', function() {
+	describe( 'set', () => {
+		it( 'should work when passing an object', () => {
 			car.set( {
 				color: 'blue',	// Override
 				wheels: 4,
@@ -69,7 +69,7 @@ describe( 'Model', function() {
 			} );
 		} );
 
-		it( 'should work when passing a key/value pair', function() {
+		it( 'should work when passing a key/value pair', () => {
 			car.set( 'color', 'blue' );
 			car.set( 'wheels', 4 );
 
@@ -80,13 +80,13 @@ describe( 'Model', function() {
 			} );
 		} );
 
-		it( 'should fire the "change" event', function() {
-			var EventInfo = modules.eventinfo;
+		it( 'should fire the "change" event', () => {
+			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 );
@@ -119,9 +119,9 @@ describe( 'Model', function() {
 			sinon.assert.calledWithExactly( spyWheels, sinon.match.instanceOf( EventInfo ), 4, sinon.match.typeOf( 'undefined' ) );
 		} );
 
-		it( 'should not fire the "change" event for the same attribute value', function() {
-			var spy = sinon.spy();
-			var spyColor = sinon.spy();
+		it( 'should not fire the "change" event for the same attribute value', () => {
+			let spy = sinon.spy();
+			let spyColor = sinon.spy();
 
 			car.on( 'change', spy );
 			car.on( 'change:color', spyColor );
@@ -135,8 +135,8 @@ describe( 'Model', function() {
 			sinon.assert.notCalled( spyColor );
 		} );
 
-		it( 'should throw when overriding already existing property', function() {
-			var CKEditorError = modules.ckeditorerror;
+		it( 'should throw when overriding already existing property', () => {
+			const CKEditorError = modules.ckeditorerror;
 
 			car.normalProperty = 1;
 
@@ -147,9 +147,9 @@ describe( 'Model', function() {
 			expect( car ).to.have.property( 'normalProperty', 1 );
 		} );
 
-		it( 'should throw when overriding already existing property (in the prototype)', function() {
-			var CKEditorError = modules.ckeditorerror;
-			var Model = modules.model;
+		it( 'should throw when overriding already existing property (in the prototype)', () => {
+			const CKEditorError = modules.ckeditorerror;
+			const Model = modules.model;
 
 			class Car extends Model {
 				method() {}
@@ -165,13 +165,13 @@ describe( 'Model', function() {
 		} );
 	} );
 
-	describe( 'extend', function() {
-		it( 'should create new Model based classes', function() {
-			var Model = modules.model;
+	describe( 'extend', () => {
+		it( 'should create new Model based classes', () => {
+			const Model = modules.model;
 
 			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 );

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

@@ -8,14 +8,14 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'utils', 'ui/domemittermixin', 'emittermixin' );
-var emitter, domEmitter, node;
+const modules = bender.amd.require( 'utils', 'ui/domemittermixin', 'emittermixin' );
+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();
@@ -33,9 +33,9 @@ beforeEach( updateEmitterInstance );
 beforeEach( updateDOMEmitterInstance );
 beforeEach( updateDOMNodeInstance );
 
-describe( 'listenTo', function() {
-	it( 'should listen to EmitterMixin events', function() {
-		var spy = bender.sinon.spy();
+describe( 'listenTo', () => {
+	it( 'should listen to EmitterMixin events', () => {
+		let spy = bender.sinon.spy();
 
 		domEmitter.listenTo( emitter, 'test', spy );
 		emitter.fire( 'test' );
@@ -43,22 +43,22 @@ describe( 'listenTo', function() {
 		sinon.assert.calledOnce( spy );
 	} );
 
-	it( 'should listen to native DOM events', function() {
-		var spy = bender.sinon.spy();
+	it( 'should listen to native DOM events', () => {
+		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 );
 	} );
 } );
 
-describe( 'stopListening', function() {
-	it( 'should stop listening to a specific event callback', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+describe( 'stopListening', () => {
+	it( 'should stop listening to a specific event callback', () => {
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'event1', spy1 );
 		domEmitter.listenTo( node, 'event2', spy2 );
@@ -75,10 +75,10 @@ describe( 'stopListening', function() {
 		sinon.assert.calledTwice( spy2 );
 	} );
 
-	it( 'should stop listening to an specific event', function() {
-		var spy1a = bender.sinon.spy();
-		var spy1b = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+	it( 'should stop listening to an specific event', () => {
+		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 );
@@ -101,9 +101,9 @@ describe( 'stopListening', function() {
 		sinon.assert.calledTwice( spy2 );
 	} );
 
-	it( 'should stop listening to all events from a specific node', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+	it( 'should stop listening to all events from a specific node', () => {
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		domEmitter.listenTo( node, 'event1', spy1 );
 		domEmitter.listenTo( node, 'event2', spy2 );
@@ -120,12 +120,12 @@ describe( 'stopListening', function() {
 		sinon.assert.calledOnce( spy2 );
 	} );
 
-	it( 'should stop listening to everything', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+	it( 'should stop listening to everything', () => {
+		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 );
@@ -146,11 +146,11 @@ describe( 'stopListening', function() {
 		expect( domEmitter ).to.not.have.property( '_listeningTo' );
 	} );
 
-	it( 'should not stop other nodes when a non-listened node is provided', function() {
-		var spy = bender.sinon.spy();
+	it( 'should not stop other nodes when a non-listened node is provided', () => {
+		let spy = bender.sinon.spy();
 
-		var node1 = getDOMNodeInstance();
-		var node2 = getDOMNodeInstance();
+		let node1 = getDOMNodeInstance();
+		let node2 = getDOMNodeInstance();
 
 		domEmitter.listenTo( node1, 'test', spy );
 
@@ -161,14 +161,14 @@ describe( 'stopListening', function() {
 		sinon.assert.called( spy );
 	} );
 
-	it( 'should pass DOM Event data to the listener', function() {
-		var spy = bender.sinon.spy();
+	it( 'should pass DOM Event data to the listener', () => {
+		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
 		} );
@@ -179,14 +179,14 @@ describe( 'stopListening', function() {
 		expect( spy.args[ 0 ][ 1 ] ).to.be.equal( mouseEvent );
 	} );
 
-	it( 'should detach native DOM event listener proxy, specific event', function() {
-		var spy1a = bender.sinon.spy();
-		var spy1b = bender.sinon.spy();
+	it( 'should detach native DOM event listener proxy, specific event', () => {
+		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' ) );
 
@@ -210,16 +210,16 @@ describe( 'stopListening', function() {
 		sinon.assert.calledTwice( spy2 );
 	} );
 
-	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();
+	it( 'should detach native DOM event listener proxy, specific callback', () => {
+		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' ) );
 
@@ -253,17 +253,17 @@ describe( 'stopListening', function() {
 		sinon.assert.calledThrice( spy2 );
 	} );
 
-	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();
+	it( 'should detach native DOM event listener proxy, specific emitter', () => {
+		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' ) );
@@ -302,17 +302,17 @@ describe( 'stopListening', function() {
 		sinon.assert.calledTwice( spy3 );
 	} );
 
-	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();
+	it( 'should detach native DOM event listener proxy, everything', () => {
+		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' ) );

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

@@ -8,29 +8,29 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'ckeditor', 'ui/region', 'ui/view', 'collection' );
+const modules = bender.amd.require( 'ckeditor', 'ui/region', 'ui/view', 'collection' );
 
 bender.tools.createSinonSandbox();
 
-var TestViewA, TestViewB;
-var region, el;
+let TestViewA, TestViewB;
+let region, el;
 
 beforeEach( createRegionInstance );
 
-describe( 'constructor', function() {
-	it( 'accepts name and element', function() {
+describe( 'constructor', () => {
+	it( 'accepts name and element', () => {
 		expect( region ).to.have.property( 'name', 'foo' );
 		expect( region ).to.have.property( 'el', el );
 	} );
 } );
 
-describe( 'views collection', function() {
-	it( 'is an instance of Collection', function() {
-		var Collection = modules.collection;
+describe( 'views collection', () => {
+	it( 'is an instance of Collection', () => {
+		const Collection = modules.collection;
 		expect( region.views ).to.be.an.instanceof( Collection );
 	} );
 
-	it( 'updates DOM when adding views', function() {
+	it( 'updates DOM when adding views', () => {
 		expect( region.el.childNodes.length ).to.be.equal( 0 );
 
 		region.views.add( new TestViewA() );
@@ -40,9 +40,9 @@ describe( 'views collection', function() {
 		expect( region.el.childNodes.length ).to.be.equal( 2 );
 	} );
 
-	it( 'updates DOM when removing views', function() {
-		var viewA = new TestViewA();
-		var viewB = new TestViewB();
+	it( 'updates DOM when removing views', () => {
+		let viewA = new TestViewA();
+		let viewB = new TestViewB();
 
 		region.views.add( viewA );
 		region.views.add( viewB );
@@ -60,10 +60,10 @@ describe( 'views collection', function() {
 	} );
 } );
 
-describe( 'destroy', function() {
-	it( 'destroys the region', function() {
+describe( 'destroy', () => {
+	it( 'destroys the region', () => {
 		// 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 );
 
@@ -74,9 +74,9 @@ describe( 'destroy', function() {
 		expect( region.el ).to.be.null;
 	} );
 
-	it( 'destroys children views', function() {
-		var view = new TestViewA();
-		var spy = bender.sinon.spy( view, 'destroy' );
+	it( 'destroys children views', () => {
+		let view = new TestViewA();
+		let spy = bender.sinon.spy( view, 'destroy' );
 
 		// Append the view to the region.
 		region.views.add( view );
@@ -90,8 +90,8 @@ describe( 'destroy', function() {
 } );
 
 function createRegionInstance() {
-	var Region = modules[ 'ui/region' ];
-	var View = modules[ 'ui/view' ];
+	const Region = modules[ 'ui/region' ];
+	const View = modules[ 'ui/view' ];
 
 	class A extends View {
 		constructor() {

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

@@ -8,15 +8,15 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'ckeditor', 'ui/view', 'ui/template' );
-var Template;
+const modules = bender.amd.require( 'ckeditor', 'ui/view', 'ui/template' );
+let Template;
 
 bender.tools.createSinonSandbox();
 beforeEach( createClassReferences );
 
-describe( 'constructor', function() {
-	it( 'accepts the definition', function() {
-		var def = {
+describe( 'constructor', () => {
+	it( 'accepts the definition', () => {
+		let def = {
 			tag: 'p'
 		};
 
@@ -24,13 +24,13 @@ describe( 'constructor', function() {
 	} );
 } );
 
-describe( 'render', function() {
-	it( 'returns null when no definition', function() {
+describe( 'render', () => {
+	it( 'returns null when no definition', () => {
 		expect( new Template().render() ).to.be.null;
 	} );
 
-	it( 'creates an element', function() {
-		var el = new Template( {
+	it( 'creates an element', () => {
+		let el = new Template( {
 			tag: 'p',
 			attrs: {
 				'class': [ 'a', 'b' ],
@@ -45,8 +45,8 @@ describe( 'render', function() {
 		expect( el.outerHTML ).to.be.equal( '<p class="a b" x="bar">foo</p>' );
 	} );
 
-	it( 'creates element\'s children', function() {
-		var el = new Template( {
+	it( 'creates element\'s children', () => {
+		let el = new Template( {
 			tag: 'p',
 			attrs: {
 				a: 'A'
@@ -73,12 +73,12 @@ describe( 'render', function() {
 	} );
 } );
 
-describe( 'callback value', function() {
-	it( 'works for attributes', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+describe( 'callback value', () => {
+	it( 'works for attributes', () => {
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			attrs: {
 				'class': spy1
@@ -102,11 +102,11 @@ describe( 'callback value', function() {
 		expect( el.outerHTML ).to.be.equal( '<p class="foo"><span id="bar"></span></p>' );
 	} );
 
-	it( 'works for "text" property', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+	it( 'works for "text" property', () => {
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
-		var el = new Template( {
+		let el = new Template( {
 			tag: 'p',
 			text: spy1,
 			children: [
@@ -127,13 +127,13 @@ describe( 'callback value', function() {
 		expect( el.outerHTML ).to.be.equal( '<p>foo</p>' );
 	} );
 
-	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();
+	it( 'works for "on" property', () => {
+		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: [
 				{
@@ -155,13 +155,13 @@ describe( 'callback value', function() {
 		sinon.assert.calledWithExactly( spy4, el, 'baz', null );
 	} );
 
-	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();
+	it( 'works for "on" property with selectors', () => {
+		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: [
 				{

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

@@ -8,21 +8,21 @@
 
 'use strict';
 
-var modules = bender.amd.require( 'ckeditor', 'ui/view', 'ui/region', 'ckeditorerror', 'model', 'eventinfo' );
-var View, TestView;
-var view;
+const modules = bender.amd.require( 'ckeditor', 'ui/view', 'ui/region', 'ckeditorerror', 'model', 'eventinfo' );
+let View, TestView;
+let view;
 
 bender.tools.createSinonSandbox();
 
 beforeEach( updateModuleReference );
 
-describe( 'constructor', function() {
-	beforeEach( function() {
+describe( 'constructor', () => {
+	beforeEach( () => {
 		setTestViewClass();
 		setTestViewInstance();
 	} );
 
-	it( 'accepts the model', function() {
+	it( 'accepts the model', () => {
 		setTestViewInstance( { a: 'foo', b: 42 } );
 
 		expect( view.model ).to.be.an.instanceof( modules.model );
@@ -31,33 +31,33 @@ describe( 'constructor', function() {
 	} );
 } );
 
-describe( 'instance', function() {
-	beforeEach( function() {
+describe( 'instance', () => {
+	beforeEach( () => {
 		setTestViewClass();
 		setTestViewInstance();
 	} );
 
-	it( 'has no default element', function() {
+	it( 'has no default element', () => {
 		expect( () => view.el ).to.throw( modules.ckeditorerror );
 	} );
 
-	it( 'has no default template', function() {
+	it( 'has no default template', () => {
 		expect( view.template ).to.be.undefined();
 	} );
 
-	it( 'has no default regions', function() {
+	it( 'has no default regions', () => {
 		expect( view.regions ).to.have.length( 0 );
 	} );
 } );
 
-describe( 'bind', function() {
+describe( 'bind', () => {
 	beforeEach( createViewInstanceWithTemplate );
 
-	it( 'returns a function that passes arguments', function() {
+	it( 'returns a function that passes arguments', () => {
 		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;
 
@@ -70,7 +70,7 @@ describe( 'bind', function() {
 		expect( spy.secondCall.calledWithExactly( 'el', 'bar' ) ).to.be.true;
 	} );
 
-	it( 'allows binding attribute to the model', function() {
+	it( 'allows binding attribute to the model', () => {
 		setTestViewClass( function() {
 			return {
 				tag: 'p',
@@ -89,7 +89,7 @@ describe( 'bind', function() {
 		expect( view.el.outerHTML ).to.be.equal( '<p class="baz">abc</p>' );
 	} );
 
-	it( 'allows binding "text" to the model', function() {
+	it( 'allows binding "text" to the model', () => {
 		setTestViewClass( function() {
 			return {
 				tag: 'p',
@@ -112,8 +112,8 @@ describe( 'bind', function() {
 		expect( view.el.outerHTML ).to.be.equal( '<p>qux</p>' );
 	} );
 
-	it( 'allows binding to the model with value processing', function() {
-		var callback = ( el, value ) =>
+	it( 'allows binding to the model with value processing', () => {
+		let callback = ( el, value ) =>
 			( value > 0 ? 'positive' : 'negative' );
 
 		setTestViewClass( function() {
@@ -133,7 +133,7 @@ describe( 'bind', function() {
 		expect( view.el.outerHTML ).to.be.equal( '<p class="negative">negative</p>' );
 	} );
 
-	it( 'allows binding to the model with custom callback', function() {
+	it( 'allows binding to the model with custom callback', () => {
 		setTestViewClass( function() {
 			return {
 				tag: 'p',
@@ -158,9 +158,9 @@ describe( 'bind', function() {
 	} );
 } );
 
-describe( 'on', function() {
-	it( 'accepts plain binding', function() {
-		var spy = bender.sinon.spy();
+describe( 'on', () => {
+	it( 'accepts plain binding', () => {
+		let spy = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -182,9 +182,9 @@ describe( 'on', function() {
 		);
 	} );
 
-	it( 'accepts an array of event bindings', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+	it( 'accepts an array of event bindings', () => {
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -211,10 +211,10 @@ describe( 'on', function() {
 		);
 	} );
 
-	it( 'accepts DOM selectors', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
-		var spy3 = bender.sinon.spy();
+	it( 'accepts DOM selectors', () => {
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
+		let spy3 = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -296,9 +296,9 @@ describe( 'on', function() {
 		sinon.assert.callCount( spy3, 0 );
 	} );
 
-	it( 'accepts function callbacks', function() {
-		var spy1 = bender.sinon.spy();
-		var spy2 = bender.sinon.spy();
+	it( 'accepts function callbacks', () => {
+		let spy1 = bender.sinon.spy();
+		let spy2 = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -329,8 +329,8 @@ describe( 'on', function() {
 		);
 	} );
 
-	it( 'supports event delegation', function() {
-		var spy = bender.sinon.spy();
+	it( 'supports event delegation', () => {
+		let spy = bender.sinon.spy();
 
 		setTestViewClass( function() {
 			return {
@@ -357,8 +357,8 @@ describe( 'on', function() {
 		);
 	} );
 
-	it( 'works for future elements', function() {
-		var spy = bender.sinon.spy();
+	it( 'works for future elements', () => {
+		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' );
@@ -381,10 +381,10 @@ describe( 'on', function() {
 	} );
 } );
 
-describe( 'render', function() {
+describe( 'render', () => {
 	beforeEach( createViewInstanceWithTemplate );
 
-	it( 'creates an element from template', function() {
+	it( 'creates an element from template', () => {
 		setTestViewInstance( { a: 1 } );
 
 		expect( view.el ).to.be.an.instanceof( HTMLElement );
@@ -392,10 +392,10 @@ describe( 'render', function() {
 	} );
 } );
 
-describe( 'destroy', function() {
+describe( 'destroy', () => {
 	beforeEach( createViewInstanceWithTemplate );
 
-	it( 'detaches the model', function() {
+	it( 'detaches the model', () => {
 		expect( view.model ).to.be.an.instanceof( modules.model );
 
 		view.destroy();
@@ -403,9 +403,9 @@ describe( 'destroy', function() {
 		expect( view.model ).to.be.null;
 	} );
 
-	it( 'detaches the element', function() {
+	it( 'detaches the element', () => {
 		// 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' );
@@ -418,10 +418,10 @@ describe( 'destroy', function() {
 		expect( view.el.parentNode ).to.be.null;
 	} );
 
-	it( 'destroys child regions', function() {
-		var Region = modules[ 'ui/region' ];
-		var region = new Region( 'test' );
-		var spy = bender.sinon.spy( region, 'destroy' );
+	it( 'destroys child regions', () => {
+		const Region = modules[ 'ui/region' ];
+		let region = new Region( 'test' );
+		let spy = bender.sinon.spy( region, 'destroy' );
 
 		view.regions.add( region );
 		view.destroy();
@@ -430,7 +430,7 @@ describe( 'destroy', function() {
 		expect( spy.calledOnce ).to.be.true;
 	} );
 
-	it( 'detaches bound model listeners', function() {
+	it( 'detaches bound model listeners', () => {
 		setTestViewClass( function() {
 			return {
 				tag: 'p',
@@ -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>' );
 
@@ -486,7 +486,7 @@ function setTestViewInstance( model ) {
 
 function dispatchEvent( el, domEvtName ) {
 	if ( !el.parentNode ) {
-		throw( 'To dispatch an event, element must be in DOM. Otherwise #target is null.' );
+		throw new Error( 'To dispatch an event, element must be in DOM. Otherwise #target is null.' );
 	}
 
 	el.dispatchEvent( new Event( domEvtName, {