Przeglądaj źródła

Fix various issues with short-circuit or unused expressions.

Maciej Gołaszewski 5 lat temu
rodzic
commit
f78b204a74

+ 3 - 3
packages/ckeditor5-code-block/src/codeblockediting.js

@@ -214,9 +214,9 @@ export default class CodeBlockEditing extends Plugin {
 				return;
 			}
 
-			leaveBlockStartOnEnter( editor, data.isSoft ) ||
-			leaveBlockEndOnEnter( editor, data.isSoft ) ||
-			breakLineOnEnter( editor );
+			if ( !leaveBlockStartOnEnter( editor, data.isSoft ) && !leaveBlockEndOnEnter( editor, data.isSoft ) ) {
+				breakLineOnEnter( editor );
+			}
 
 			data.preventDefault();
 			evt.stop();

+ 1 - 1
packages/ckeditor5-engine/src/controller/datacontroller.js

@@ -72,7 +72,7 @@ export default class DataController {
 		 *
 		 * @member {module:engine/dataprocessor/dataprocessor~DataProcessor} #processor
 		 */
-		this.processor;
+		this.processor = undefined;
 
 		/**
 		 * Mapper used for the conversion. It has no permanent bindings, because they are created when getting data and

+ 1 - 1
packages/ckeditor5-engine/tests/view/node.js

@@ -214,7 +214,7 @@ describe( 'Node', () => {
 		} );
 	} );
 
-	describe( 'getIndex()', () => {
+	describe( '#index getter', () => {
 		it( 'should return null if the parent is null', () => {
 			expect( root.index ).to.be.null;
 		} );

+ 1 - 1
packages/ckeditor5-font/src/ui/colorui.js

@@ -75,7 +75,7 @@ export default class ColorUI extends Plugin {
 		 *
 		 * @member {module:font/ui/colortableview~ColorTableView}
 		 */
-		this.colorTableView;
+		this.colorTableView = undefined;
 	}
 
 	/**

+ 0 - 3
packages/ckeditor5-ui/tests/viewcollection.js

@@ -100,9 +100,6 @@ describe( 'ViewCollection', () => {
 					children: collection
 				} );
 
-				// Render view#template along with collection of children.
-				view.element;
-
 				const viewC = getView( 'C' );
 
 				// Modify the collection, while the view#element has already

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

@@ -396,9 +396,8 @@ describe( 'Config', () => {
 
 		it( 'should not be possible to retrieve value directly from config object', () => {
 			expect( config.creator ).to.be.undefined;
-			expect( () => {
-				config.resize.maxHeight;
-			} ).to.throw();
+			// Check if 'resize.maxHeight' would be accessible;
+			expect( config.resize ).to.be.undefined;
 		} );
 
 		it( 'should not be possible to alter config object by altering returned value', () => {
@@ -430,7 +429,8 @@ describe( 'Config', () => {
 		} );
 
 		it( 'should return class & functions references from config array', () => {
-			class Foo {}
+			class Foo {
+			}
 
 			function bar() {
 				return 'bar';

+ 1 - 1
packages/ckeditor5-word-count/src/wordcount.js

@@ -120,7 +120,7 @@ export default class WordCount extends Plugin {
 		 * @readonly
 		 * @type {module:ui/view~View}
 		 */
-		this._outputView;
+		this._outputView = undefined;
 
 		/**
 		 * A regular expression used to recognize words in the editor's content.