8
0
Quellcode durchsuchen

Code style: Switched to ESLint.

Kamil Piechaczek vor 8 Jahren
Ursprung
Commit
cea5ae080d

+ 1 - 1
packages/ckeditor5-typing/src/deletecommand.js

@@ -77,7 +77,7 @@ export default class DeleteCommand extends Command {
 
 			let changeCount = 0;
 
-			selection.getFirstRange().getMinimalFlatRanges().forEach( ( range ) => {
+			selection.getFirstRange().getMinimalFlatRanges().forEach( range => {
 				changeCount += count(
 					range.getWalker( { singleCharacters: true, ignoreElementEnd: true, shallow: true } )
 				);

+ 1 - 1
packages/ckeditor5-typing/src/input.js

@@ -131,7 +131,7 @@ class MutationHandler {
 	 * @param {module:engine/view/selection~Selection|null} viewSelection
 	 */
 	handle( mutations, viewSelection ) {
-		for ( let mutation of mutations ) {
+		for ( const mutation of mutations ) {
 			// Fortunately it will never be both.
 			this._handleTextMutation( mutation, viewSelection );
 			this._handleTextNodeInsertion( mutation );

+ 10 - 10
packages/ckeditor5-typing/tests/bogusbr-integration.js

@@ -42,7 +42,7 @@ describe( 'Bogus BR integration', () => {
 		// Tests using 'insertText' generates same mutations as typing. This means they will behave
 		// a little different in every browser (as native mutations may be different in different browsers).
 
-		it( 'space is inserted on the end of the line (paragraph)', ( done ) => {
+		it( 'space is inserted on the end of the line (paragraph)', done => {
 			editor.document.enqueueChanges( () => {
 				editor.editing.view.getDomRoot().focus();
 				setData( editor.document, '<paragraph>Foo[]</paragraph>' );
@@ -56,7 +56,7 @@ describe( 'Bogus BR integration', () => {
 			document.execCommand( 'insertText', false, ' ' );
 		} );
 
-		it( 'space is inserted on the end of the line (empty paragraph)', ( done ) => {
+		it( 'space is inserted on the end of the line (empty paragraph)', done => {
 			editor.document.enqueueChanges( () => {
 				editor.editing.view.getDomRoot().focus();
 				setData( editor.document, '<paragraph>[]</paragraph>' );
@@ -70,7 +70,7 @@ describe( 'Bogus BR integration', () => {
 			document.execCommand( 'insertText', false, ' ' );
 		} );
 
-		it( 'space is inserted on the end of the line (bold)', ( done ) => {
+		it( 'space is inserted on the end of the line (bold)', done => {
 			editor.document.enqueueChanges( () => {
 				editor.editing.view.getDomRoot().focus();
 				setData( editor.document, '<paragraph><$text bold="true">Foo[]</$text></paragraph>' );
@@ -88,7 +88,7 @@ describe( 'Bogus BR integration', () => {
 	describe( 'mutations', () => {
 		// This tests use fixed list of mutation mocks to simulate specific browser behaviours.
 
-		it( 'space is inserted on the end of the paragraph', ( done ) => {
+		it( 'space is inserted on the end of the paragraph', done => {
 			editor.document.enqueueChanges( () => {
 				editor.editing.view.getDomRoot().focus();
 				setData( editor.document, '<paragraph>Foo[]</paragraph>' );
@@ -114,7 +114,7 @@ describe( 'Bogus BR integration', () => {
 			] );
 		} );
 
-		it( 'space is inserted on the end of the line paragraph (with bogus br)', ( done ) => {
+		it( 'space is inserted on the end of the line paragraph (with bogus br)', done => {
 			editor.document.enqueueChanges( () => {
 				editor.editing.view.getDomRoot().focus();
 				setData( editor.document, '<paragraph>Foo[]</paragraph>' );
@@ -126,7 +126,7 @@ describe( 'Bogus BR integration', () => {
 			}, { priority: 'low' } );
 
 			const paragraph = domRoot.childNodes[ 0 ];
-			const text = paragraph.childNodes [ 0 ];
+			const text = paragraph.childNodes[ 0 ];
 			const br = document.createElement( 'br' );
 
 			mutationObserver.disable();
@@ -143,7 +143,7 @@ describe( 'Bogus BR integration', () => {
 			] );
 		} );
 
-		it( 'word is properly corrected on the end of the block element (with bogus br)', ( done ) => {
+		it( 'word is properly corrected on the end of the block element (with bogus br)', done => {
 			editor.document.enqueueChanges( () => {
 				editor.editing.view.getDomRoot().focus();
 				setData( editor.document, '<paragraph>Foo hous[]</paragraph>' );
@@ -155,7 +155,7 @@ describe( 'Bogus BR integration', () => {
 			}, { priority: 'low' } );
 
 			const paragraph = domRoot.childNodes[ 0 ];
-			const text = paragraph.childNodes [ 0 ];
+			const text = paragraph.childNodes[ 0 ];
 			const br = document.createElement( 'br' );
 
 			mutationObserver.disable();
@@ -185,8 +185,8 @@ describe( 'Bogus BR integration', () => {
 			oldValue: null,
 			previousSibling: previousSibling || null,
 			removedNodes: [],
-			target: target,
-			type: type
+			target,
+			type
 		};
 	}
 } );

+ 1 - 3
packages/ckeditor5-typing/tests/delete.js

@@ -11,9 +11,7 @@ describe( 'Delete feature', () => {
 	let editor, editingView;
 
 	beforeEach( () => {
-		return VirtualTestEditor.create( {
-				plugins: [ Delete ]
-			} )
+		return VirtualTestEditor.create( { plugins: [ Delete ] } )
 			.then( newEditor => {
 				editor = newEditor;
 				editingView = editor.editing.view;

+ 1 - 8
packages/ckeditor5-typing/tests/deletecommand-integration.js

@@ -12,14 +12,7 @@ describe( 'DeleteCommand integration', () => {
 	let editor, doc;
 
 	beforeEach( () => {
-		return ModelTestEditor.create( {
-				plugins: [
-					UndoEngine
-				],
-				typing: {
-					undoStep: 3
-				}
-			} )
+		return ModelTestEditor.create( { plugins: [ UndoEngine ], typing: { undoStep: 3 } } )
 			.then( newEditor => {
 				editor = newEditor;
 				doc = editor.document;

+ 2 - 2
packages/ckeditor5-typing/tests/deleteobserver.js

@@ -11,11 +11,11 @@ import DomEventData from '@ckeditor/ckeditor5-engine/src/view/observer/domeventd
 import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
 
 describe( 'DeleteObserver', () => {
-	let viewDocument, observer;
+	let viewDocument;
 
 	beforeEach( () => {
 		viewDocument = new ViewDocument();
-		observer = viewDocument.addObserver( DeleteObserver );
+		viewDocument.addObserver( DeleteObserver );
 	} );
 
 	// See ckeditor/ckeditor5-enter#10.

+ 1 - 3
packages/ckeditor5-typing/tests/input.js

@@ -31,9 +31,7 @@ describe( 'Input feature', () => {
 	before( () => {
 		listenter = Object.create( EmitterMixin );
 
-		return VirtualTestEditor.create( {
-				plugins: [ Input, Paragraph ]
-			} )
+		return VirtualTestEditor.create( { plugins: [ Input, Paragraph ] } )
 			.then( newEditor => {
 				// Mock image feature.
 				newEditor.document.schema.registerItem( 'image', '$inline' );

+ 7 - 6
packages/ckeditor5-typing/tests/inputcommand-integration.js

@@ -17,8 +17,7 @@ import Enter from '@ckeditor/ckeditor5-enter/src/enter';
 import Range from '@ckeditor/ckeditor5-engine/src/model/range';
 import Position from '@ckeditor/ckeditor5-engine/src/model/position';
 
-import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
-import { getData as getModelData } from  '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+import { setData as setModelData, getData as getModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
 describe( 'InputCommand integration', () => {
@@ -55,7 +54,7 @@ describe( 'InputCommand integration', () => {
 
 	function simulateTyping( text ) {
 		// While typing, every character is an atomic change.
-		text.split( '' ).forEach( ( character ) => {
+		text.split( '' ).forEach( character => {
 			editor.execute( 'input', {
 				text: character
 			} );
@@ -64,7 +63,7 @@ describe( 'InputCommand integration', () => {
 
 	function simulateBatches( batches ) {
 		// Use longer text at once in input command.
-		batches.forEach( ( batch ) => {
+		batches.forEach( batch => {
 			editor.execute( 'input', {
 				text: batch
 			} );
@@ -191,8 +190,10 @@ describe( 'InputCommand integration', () => {
 			italicView.fire( 'execute' );
 			simulateTyping( 'z' );
 
-			expectOutput( '<paragraph>Foo <$text bold="true">B</$text><$text italic="true"><$text bold="true">a</$text></$text>z[] Bar</paragraph>',
-				'<p>Foo <strong>B</strong><em><strong>a</strong></em>z{} Bar</p>' );
+			expectOutput(
+				'<paragraph>Foo <$text bold="true">B</$text><$text italic="true"><$text bold="true">a</$text></$text>z[] Bar</paragraph>',
+				'<p>Foo <strong>B</strong><em><strong>a</strong></em>z{} Bar</p>'
+			);
 
 			editor.execute( 'undo' );
 

+ 9 - 9
packages/ckeditor5-typing/tests/spellchecking.js

@@ -123,7 +123,7 @@ describe( 'Spellchecking integration', () => {
 	describe( 'Plain text spellchecking (insertText)', () => {
 		// This tests emulates spellchecker correction on non-styled text by inserting correction text via native 'insertText' command.
 
-		it( 'should replace with longer word (collapsed)', ( done ) => {
+		it( 'should replace with longer word (collapsed)', done => {
 			onChangesDone = () => {
 				expectContent( editor,
 					'<paragraph>The Foo house[] a is a Foo hous e. A Foo athat and Foo xhat. This is an istane</paragraph>' +
@@ -138,7 +138,7 @@ describe( 'Spellchecking integration', () => {
 			emulateSpellcheckerInsertText( editor, 0, 12, 12, 'e', onChangesDone );
 		} );
 
-		it( 'should replace with longer word (non-collapsed)', ( done ) => {
+		it( 'should replace with longer word (non-collapsed)', done => {
 			onChangesDone = () => {
 				expectContent( editor,
 					'<paragraph>The Foo house[] a is a Foo hous e. A Foo athat and Foo xhat. This is an istane</paragraph>' +
@@ -153,7 +153,7 @@ describe( 'Spellchecking integration', () => {
 			emulateSpellcheckerInsertText( editor, 0, 8, 12, 'house', onChangesDone );
 		} );
 
-		it( 'should replace with shorter word (merging letter after - collapsed)', ( done ) => {
+		it( 'should replace with shorter word (merging letter after - collapsed)', done => {
 			onChangesDone = () => {
 				expectContent( editor,
 					'<paragraph>The Foo hous a is a Foo house[]. A Foo athat and Foo xhat. This is an istane</paragraph>' +
@@ -168,7 +168,7 @@ describe( 'Spellchecking integration', () => {
 			emulateSpellcheckerInsertText( editor, 0, 28, 30, 'e', onChangesDone );
 		} );
 
-		it( 'should replace with shorter word (merging letter after - non-collapsed)', ( done ) => {
+		it( 'should replace with shorter word (merging letter after - non-collapsed)', done => {
 			onChangesDone = () => {
 				expectContent( editor,
 					'<paragraph>The Foo hous a is a Foo house[]. A Foo athat and Foo xhat. This is an istane</paragraph>' +
@@ -183,7 +183,7 @@ describe( 'Spellchecking integration', () => {
 			emulateSpellcheckerInsertText( editor, 0, 24, 30, 'house', onChangesDone );
 		} );
 
-		it( 'should replace with same length text', ( done ) => {
+		it( 'should replace with same length text', done => {
 			onChangesDone = () => {
 				expectContent( editor,
 					'<paragraph>The Foo hous a is a Foo hous e. A Food that[] and Foo xhat. This is an istane</paragraph>' +
@@ -198,7 +198,7 @@ describe( 'Spellchecking integration', () => {
 			emulateSpellcheckerInsertText( editor, 0, 37, 43, 'd that', onChangesDone );
 		} );
 
-		it( 'should replace with longer word on the paragraph end', ( done ) => {
+		it( 'should replace with longer word on the paragraph end', done => {
 			onChangesDone = () => {
 				expectContent( editor,
 					'<paragraph>The Foo hous a is a Foo hous e. A Foo athat and Foo xhat. This is an instance[]</paragraph>' +
@@ -213,7 +213,7 @@ describe( 'Spellchecking integration', () => {
 			emulateSpellcheckerInsertText( editor, 0, 69, 75, 'instance', onChangesDone );
 		} );
 
-		it( 'should replace with shorter word on the paragraph end', ( done ) => {
+		it( 'should replace with shorter word on the paragraph end', done => {
 			onChangesDone = () => {
 				expectContent( editor,
 					'<paragraph>The Foo hous a is a Foo hous e. A Foo athat and Foo xhat. This is an istane</paragraph>' +
@@ -240,8 +240,8 @@ function emulateSpellcheckerMutation( editor, nodeIndex, resultPositionIndex, ol
 	view.fire( 'mutations',
 		[ {
 			type: 'text',
-			oldText: oldText,
-			newText: newText,
+			oldText,
+			newText,
 			node: viewRoot.getChild( nodeIndex ).getChild( 0 )
 		} ],
 		viewSelection