8
0
Aleksander Nowodzinski 6 лет назад
Родитель
Сommit
29929a18f3

+ 3 - 2
packages/ckeditor5-font/tests/ui/colorgrid.js

@@ -11,10 +11,11 @@ import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
 import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
 import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';
 import FocusCycler from '@ckeditor/ckeditor5-ui/src/focuscycler';
 import FocusCycler from '@ckeditor/ckeditor5-ui/src/focuscycler';
 import ColorTile from '../../src/ui/colortile';
 import ColorTile from '../../src/ui/colortile';
-
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
 
 describe( 'ColorGrid', () => {
 describe( 'ColorGrid', () => {
+	let locale, colorGrid;
+
 	const colorsDefinition = [
 	const colorsDefinition = [
 		{
 		{
 			color: '#000',
 			color: '#000',
@@ -36,7 +37,6 @@ describe( 'ColorGrid', () => {
 			}
 			}
 		}
 		}
 	];
 	];
-	let locale, colorGrid;
 
 
 	beforeEach( () => {
 	beforeEach( () => {
 		locale = { t() {} };
 		locale = { t() {} };
@@ -145,6 +145,7 @@ describe( 'ColorGrid', () => {
 				expect( colorGrid.items.length ).to.equal( 4 );
 				expect( colorGrid.items.length ).to.equal( 4 );
 				sinon.assert.calledOnce( spy );
 				sinon.assert.calledOnce( spy );
 			} );
 			} );
+
 			it( 'removes element', () => {
 			it( 'removes element', () => {
 				const spy = sinon.spy( colorGrid.focusTracker, 'remove' );
 				const spy = sinon.spy( colorGrid.focusTracker, 'remove' );
 
 

+ 5 - 0
packages/ckeditor5-font/tests/ui/colortableview.js

@@ -17,6 +17,7 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 
 
 describe( 'ColorTableView', () => {
 describe( 'ColorTableView', () => {
 	let locale, colorTableView;
 	let locale, colorTableView;
+
 	const colorsDefinition = [
 	const colorsDefinition = [
 		{
 		{
 			color: '#000',
 			color: '#000',
@@ -142,6 +143,7 @@ describe( 'ColorTableView', () => {
 
 
 	describe( 'static colors grid', () => {
 	describe( 'static colors grid', () => {
 		let staticColorTable;
 		let staticColorTable;
+
 		beforeEach( () => {
 		beforeEach( () => {
 			staticColorTable = colorTableView.items.get( 1 );
 			staticColorTable = colorTableView.items.get( 1 );
 		} );
 		} );
@@ -187,6 +189,7 @@ describe( 'ColorTableView', () => {
 			isEnabled: false,
 			isEnabled: false,
 			hasBorder: true
 			hasBorder: true
 		};
 		};
+
 		let recentColorsGridView, recentColorModel;
 		let recentColorsGridView, recentColorModel;
 
 
 		beforeEach( () => {
 		beforeEach( () => {
@@ -198,10 +201,12 @@ describe( 'ColorTableView', () => {
 			it( 'has proper length of populated items', () => {
 			it( 'has proper length of populated items', () => {
 				expect( recentColorModel.length ).to.equal( 5 );
 				expect( recentColorModel.length ).to.equal( 5 );
 			} );
 			} );
+
 			for ( let i = 0; i < 5; i++ ) {
 			for ( let i = 0; i < 5; i++ ) {
 				it( `initialized item with index: "${ i }" has proper attributes`, () => {
 				it( `initialized item with index: "${ i }" has proper attributes`, () => {
 					const modelItem = recentColorModel.get( i );
 					const modelItem = recentColorModel.get( i );
 					const viewItem = recentColorsGridView.items.get( i );
 					const viewItem = recentColorsGridView.items.get( i );
+
 					expect( modelItem.color ).to.equal( 'hsla(0, 0%, 0%, 0)' );
 					expect( modelItem.color ).to.equal( 'hsla(0, 0%, 0%, 0)' );
 					expect( modelItem.isEnabled ).to.be.false;
 					expect( modelItem.isEnabled ).to.be.false;
 					expect( modelItem.hasBorder ).to.be.true;
 					expect( modelItem.hasBorder ).to.be.true;

+ 3 - 3
packages/ckeditor5-font/tests/ui/colortile.js

@@ -7,14 +7,14 @@ import ColorTile from './../../src/ui/colortile';
 import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 
 
 describe( 'ColorTile', () => {
 describe( 'ColorTile', () => {
-	it( 'inhertence from ButtonView', () => {
-		const colorTile = new ColorTile();
-		expect( colorTile ).to.be.instanceOf( ButtonView );
+	it( 'inherits from ButtonView', () => {
+		expect( new ColorTile() ).to.be.instanceOf( ButtonView );
 	} );
 	} );
 
 
 	it( 'has proper attributes and classes', () => {
 	it( 'has proper attributes and classes', () => {
 		const colorTile = new ColorTile();
 		const colorTile = new ColorTile();
 		colorTile.render();
 		colorTile.render();
+
 		expect( colorTile.color ).to.be.undefined;
 		expect( colorTile.color ).to.be.undefined;
 		expect( colorTile.hasBorder ).to.be.undefined;
 		expect( colorTile.hasBorder ).to.be.undefined;
 
 

+ 19 - 12
packages/ckeditor5-font/tests/ui/colorui.js

@@ -21,12 +21,10 @@ describe( 'ColorUI', () => {
 				icon: '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"></svg>',
 				icon: '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"></svg>',
 				dropdownLabel: 'Test Color'
 				dropdownLabel: 'Test Color'
 			} );
 			} );
+
 			editor.commands.add( 'testColorCommand', new FontColorCommand( editor ) );
 			editor.commands.add( 'testColorCommand', new FontColorCommand( editor ) );
 		}
 		}
 
 
-		/**
-		 * @inheritDoc
-		 */
 		static get pluginName() {
 		static get pluginName() {
 			return 'TestColorPlugin';
 			return 'TestColorPlugin';
 		}
 		}
@@ -37,14 +35,17 @@ describe( 'ColorUI', () => {
 			'yellow',
 			'yellow',
 			{
 			{
 				color: '#000',
 				color: '#000',
-			}, {
+			},
+			{
 				color: 'rgb(255, 255, 255)',
 				color: 'rgb(255, 255, 255)',
 				label: 'White',
 				label: 'White',
 				hasBorder: true
 				hasBorder: true
-			}, {
+			},
+			{
 				color: 'red',
 				color: 'red',
 				label: 'RED'
 				label: 'RED'
-			}, {
+			},
+			{
 				color: '#00FF00',
 				color: '#00FF00',
 				label: 'Green',
 				label: 'Green',
 				hasBorder: false
 				hasBorder: false
@@ -194,7 +195,7 @@ describe( 'ColorUI', () => {
 
 
 		describe( 'localization', () => {
 		describe( 'localization', () => {
 			beforeEach( () => {
 			beforeEach( () => {
-				return localizedEditor();
+				return createLocalizedEditor();
 			} );
 			} );
 
 
 			it( 'works for the #buttonView', () => {
 			it( 'works for the #buttonView', () => {
@@ -214,16 +215,20 @@ describe( 'ColorUI', () => {
 					{
 					{
 						color: 'yellow',
 						color: 'yellow',
 						label: 'żółty'
 						label: 'żółty'
-					}, {
+					},
+					{
 						color: '#000',
 						color: '#000',
 						label: '#000'
 						label: '#000'
-					}, {
+					},
+					{
 						color: 'rgb(255,255,255)',
 						color: 'rgb(255,255,255)',
 						label: 'Biały'
 						label: 'Biały'
-					}, {
+					},
+					{
 						color: 'red',
 						color: 'red',
 						label: 'CZERWONY'
 						label: 'CZERWONY'
-					}, {
+					},
+					{
 						color: '#00FF00',
 						color: '#00FF00',
 						label: 'Zielony'
 						label: 'Zielony'
 					}
 					}
@@ -233,11 +238,13 @@ describe( 'ColorUI', () => {
 					it( `tested color ${ test.color } with name ${ test.label }.`, () => {
 					it( `tested color ${ test.color } with name ${ test.label }.`, () => {
 						const colorGrid = dropdown.colorTableView.items.get( 1 );
 						const colorGrid = dropdown.colorTableView.items.get( 1 );
 						const tile = colorGrid.items.find( colorTile => test.color === colorTile.color );
 						const tile = colorGrid.items.find( colorTile => test.color === colorTile.color );
+
 						expect( tile.label ).to.equal( test.label );
 						expect( tile.label ).to.equal( test.label );
 					} );
 					} );
 				} );
 				} );
 			} );
 			} );
-			function localizedEditor() {
+
+			function createLocalizedEditor() {
 				const editorElement = document.createElement( 'div' );
 				const editorElement = document.createElement( 'div' );
 				document.body.appendChild( editorElement );
 				document.body.appendChild( editorElement );