浏览代码

Code style: fix code issues.

Maciej Gołaszewski 5 年之前
父节点
当前提交
7cc0c40026

+ 1 - 1
packages/ckeditor5-utils/src/dom/position.js

@@ -250,7 +250,7 @@ function getAbsoluteRectCoordinates( { left, top } ) {
 
 	return {
 		left: left + scrollX,
-		top: top + scrollY,
+		top: top + scrollY
 	};
 }
 

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

@@ -55,7 +55,7 @@ describe( 'Config', () => {
 		it( 'should set default parameters', () => {
 			const defaultConfig = {
 				foo: 1,
-				bar: 2,
+				bar: 2
 			};
 
 			config = new Config( {}, defaultConfig );
@@ -86,11 +86,11 @@ describe( 'Config', () => {
 		it( 'passed parameters should override default parameters', () => {
 			const defaultConfig = {
 				foo: 1,
-				bar: 2,
+				bar: 2
 			};
 
 			config = new Config( {
-				foo: 10,
+				foo: 10
 			}, defaultConfig );
 
 			expect( config.get( 'foo' ) ).to.equal( 10 );
@@ -106,7 +106,7 @@ describe( 'Config', () => {
 				b: {
 					foo: {
 						first: 1,
-						second: 2,
+						second: 2
 					}
 				}
 			};

+ 24 - 24
packages/ckeditor5-utils/tests/difftochanges.js

@@ -8,41 +8,41 @@ import diffToChanges from '../src/difftochanges';
 
 describe( 'diffToChanges', () => {
 	describe( 'equal patterns', () => {
-		test( 0,		'',				'' );
-		test( 0,		'abc',			'abc' );
+		testDiff( 0,		'',				'' );
+		testDiff( 0,		'abc',			'abc' );
 	} );
 
 	describe( 'insertion', () => {
-		test( 1,		'',				'abc' );
-		test( 1,		'abc',			'abcd' );
-		test( 1,		'abc',			'abcdef' );
-		test( 2,		'abc',			'xxabcyy' );
-		test( 2,		'abc',			'axxbyyc' );
+		testDiff( 1,		'',				'abc' );
+		testDiff( 1,		'abc',			'abcd' );
+		testDiff( 1,		'abc',			'abcdef' );
+		testDiff( 2,		'abc',			'xxabcyy' );
+		testDiff( 2,		'abc',			'axxbyyc' );
 	} );
 
 	describe( 'deletion', () => {
-		test( 1,		'abc',			'' );
-		test( 1,		'abc',			'ac' );
-		test( 1,		'abc',			'bc' );
-		test( 1,		'abc',			'ab' );
-		test( 1,		'abc',			'c' );
-		test( 2,		'abc',			'b' );
+		testDiff( 1,		'abc',			'' );
+		testDiff( 1,		'abc',			'ac' );
+		testDiff( 1,		'abc',			'bc' );
+		testDiff( 1,		'abc',			'ab' );
+		testDiff( 1,		'abc',			'c' );
+		testDiff( 2,		'abc',			'b' );
 	} );
 
 	describe( 'replacement', () => {
-		test( 2,		'abc',			'def' );
-		test( 2,		'abc',			'axc' );
-		test( 2,		'abc',			'axyc' );
-		test( 2,		'abc',			'xybc' );
-		test( 2,		'abc',			'abxy' );
+		testDiff( 2,		'abc',			'def' );
+		testDiff( 2,		'abc',			'axc' );
+		testDiff( 2,		'abc',			'axyc' );
+		testDiff( 2,		'abc',			'xybc' );
+		testDiff( 2,		'abc',			'abxy' );
 	} );
 
 	describe( 'various', () => {
-		test( 3,		'abc',			'xbccy' );
-		test( 2,		'abcdef',		'defabc' );
-		test( 4,		'abcdef',		'axxdeyyfz' );
-		test( 4,		'abcdef',		'xybzc' );
-		test( 5,		'abcdef',		'bdxfy' );
+		testDiff( 3,		'abc',			'xbccy' );
+		testDiff( 2,		'abcdef',		'defabc' );
+		testDiff( 4,		'abcdef',		'axxdeyyfz' );
+		testDiff( 4,		'abcdef',		'xybzc' );
+		testDiff( 5,		'abcdef',		'bdxfy' );
 	} );
 
 	it( 'works with arrays', () => {
@@ -62,7 +62,7 @@ describe( 'diffToChanges', () => {
 		expect( changes ).to.have.lengthOf( 3 );
 	} );
 
-	function test( expectedChangeNumber, oldStr, newStr ) {
+	function testDiff( expectedChangeNumber, oldStr, newStr ) {
 		it( `${ oldStr } => ${ newStr }`, () => {
 			const changes = diffToChanges( diff( oldStr, newStr ), newStr );
 			const oldStrChars = Array.from( oldStr );

+ 11 - 11
packages/ckeditor5-utils/tests/dom/getcommonancestor.js

@@ -30,33 +30,33 @@ describe( 'getParents', () => {
 		div = createElement( document, 'div', {}, [ p1, p2 ] );
 	} );
 
-	function test( a, b, lca ) {
+	function testParents( a, b, lca ) {
 		expect( getCommonAncestor( a, b ) ).to.equal( lca );
 		expect( getCommonAncestor( b, a ) ).to.equal( lca );
 	}
 
 	it( 'should return lowest common ancestor of nodes in different tree branches', () => {
-		test( p1, p2, div );
-		test( span1, span2, p1 );
-		test( b, span2, p1 );
-		test( i, b, div );
+		testParents( p1, p2, div );
+		testParents( span1, span2, p1 );
+		testParents( b, span2, p1 );
+		testParents( i, b, div );
 	} );
 
 	it( 'should return one of nodes if it is a parent of another node', () => {
-		test( div, p1, div );
-		test( p1, b, p1 );
+		testParents( div, p1, div );
+		testParents( p1, b, p1 );
 	} );
 
 	it( 'should return the node if both parameters are same', () => {
-		test( div, div, div );
-		test( b, b, b );
+		testParents( div, div, div );
+		testParents( b, b, b );
 	} );
 
 	it( 'should return null for nodes that do not have common ancestor (different trees)', () => {
 		const diffB = createElement( document, 'b' );
 		const diffDiv = createElement( document, 'div', {}, diffB );
 
-		test( diffB, span1, null );
-		test( diffDiv, p1, null );
+		testParents( diffB, span1, null );
+		testParents( diffDiv, p1, null );
 	} );
 } );

+ 2 - 2
packages/ckeditor5-utils/tests/dom/position.js

@@ -109,7 +109,7 @@ describe( 'getOptimalPosition()', () => {
 				innerWidth: 10000,
 				innerHeight: 10000,
 				scrollX: 100,
-				scrollY: 100,
+				scrollY: 100
 			} );
 
 			assertPosition( { element, target, positions: [ attachLeft ] }, {
@@ -170,7 +170,7 @@ describe( 'getOptimalPosition()', () => {
 				}, {
 					position: 'absolute',
 					borderLeftWidth: '20px',
-					borderTopWidth: '40px',
+					borderTopWidth: '40px'
 				} );
 
 				element.parentElement = parent;

+ 1 - 1
packages/ckeditor5-utils/tests/manual/tickets/148/1.js

@@ -29,7 +29,7 @@ function updateSourcePosition() {
 		target,
 		positions: [
 			positions.above,
-			positions.below,
+			positions.below
 		],
 		limiter
 	} );