Browse Source

Code style: Aligned code style to new ESLint version.

Kamil Piechaczek 8 years ago
parent
commit
30710c83b3

+ 43 - 37
packages/ckeditor5-editor-classic/tests/classiceditor.js

@@ -60,12 +60,13 @@ describe( 'ClassicEditor', () => {
 
 	describe( 'create()', () => {
 		beforeEach( function() {
-			return ClassicEditor.create( editorElement, {
-				plugins: [ Paragraph, Bold ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-			} );
+			return ClassicEditor
+				.create( editorElement, {
+					plugins: [ Paragraph, Bold ]
+				} )
+				.then( newEditor => {
+					editor = newEditor;
+				} );
 		} );
 
 		afterEach( () => {
@@ -92,17 +93,18 @@ describe( 'ClassicEditor', () => {
 		it( 'creates an instance of a ClassicEditor child class', () => {
 			class CustomClassicEditor extends ClassicEditor {}
 
-			return CustomClassicEditor.create( editorElement, {
-				plugins: [ Paragraph, Bold ]
-			} )
-			.then( newEditor => {
-				expect( newEditor ).to.be.instanceof( CustomClassicEditor );
-				expect( newEditor ).to.be.instanceof( ClassicEditor );
+			return CustomClassicEditor
+				.create( editorElement, {
+					plugins: [ Paragraph, Bold ]
+				} )
+				.then( newEditor => {
+					expect( newEditor ).to.be.instanceof( CustomClassicEditor );
+					expect( newEditor ).to.be.instanceof( ClassicEditor );
 
-				expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
+					expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
 
-				return newEditor.destroy();
-			} );
+					return newEditor.destroy();
+				} );
 		} );
 	} );
 
@@ -127,14 +129,15 @@ describe( 'ClassicEditor', () => {
 				}
 			}
 
-			return ClassicEditor.create( editorElement, {
-				plugins: [ EventWatcher ]
-			} )
-			.then( newEditor => {
-				expect( fired ).to.deep.equal( [ 'pluginsReady', 'uiReady', 'dataReady', 'ready' ] );
+			return ClassicEditor
+				.create( editorElement, {
+					plugins: [ EventWatcher ]
+				} )
+				.then( newEditor => {
+					expect( fired ).to.deep.equal( [ 'pluginsReady', 'uiReady', 'dataReady', 'ready' ] );
 
-				editor = newEditor;
-			} );
+					editor = newEditor;
+				} );
 		} );
 
 		it( 'fires dataReady once data is loaded', () => {
@@ -148,14 +151,15 @@ describe( 'ClassicEditor', () => {
 				}
 			}
 
-			return ClassicEditor.create( editorElement, {
-				plugins: [ EventWatcher, Paragraph, Bold ]
-			} )
-			.then( newEditor => {
-				expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
+			return ClassicEditor
+				.create( editorElement, {
+					plugins: [ EventWatcher, Paragraph, Bold ]
+				} )
+				.then( newEditor => {
+					expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
 
-				editor = newEditor;
-			} );
+					editor = newEditor;
+				} );
 		} );
 
 		it( 'fires uiReady once UI is ready', () => {
@@ -169,20 +173,22 @@ describe( 'ClassicEditor', () => {
 				}
 			}
 
-			return ClassicEditor.create( editorElement, {
-				plugins: [ EventWatcher ]
-			} )
-			.then( newEditor => {
-				expect( isReady ).to.be.true;
+			return ClassicEditor
+				.create( editorElement, {
+					plugins: [ EventWatcher ]
+				} )
+				.then( newEditor => {
+					expect( isReady ).to.be.true;
 
-				editor = newEditor;
-			} );
+					editor = newEditor;
+				} );
 		} );
 	} );
 
 	describe( 'destroy', () => {
 		beforeEach( function() {
-			return ClassicEditor.create( editorElement, { plugins: [ Paragraph ] } )
+			return ClassicEditor
+				.create( editorElement, { plugins: [ Paragraph ] } )
 				.then( newEditor => {
 					editor = newEditor;
 				} );

+ 60 - 57
packages/ckeditor5-editor-classic/tests/classiceditorui.js

@@ -27,23 +27,24 @@ describe( 'ClassicEditorUI', () => {
 		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
-		return ClassicTestEditor.create( editorElement, {
-			toolbar: [ 'foo', 'bar' ],
-			ui: {
-				width: 100,
-				height: 200
-			}
-		} )
-		.then( newEditor => {
-			editor = newEditor;
-
-			view = new ClassicEditorUIView( editor.locale );
-			ui = new ClassicEditorUI( editor, view );
-			editable = editor.editing.view.getRoot();
-
-			ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
-			ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
-		} );
+		return ClassicTestEditor
+			.create( editorElement, {
+				toolbar: [ 'foo', 'bar' ],
+				ui: {
+					width: 100,
+					height: 200
+				}
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				view = new ClassicEditorUIView( editor.locale );
+				ui = new ClassicEditorUI( editor, view );
+				editable = editor.editing.view.getRoot();
+
+				ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
+				ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
+			} );
 	} );
 
 	afterEach( () => {
@@ -95,25 +96,26 @@ describe( 'ClassicEditorUI', () => {
 				editorElement = document.createElement( 'div' );
 				document.body.appendChild( editorElement );
 
-				return ClassicTestEditor.create( editorElement, {
-					toolbar: {
-						items: [ 'foo', 'bar' ],
-						viewportTopOffset: 100
-					}
-				} )
-				.then( editor => {
-					view = new ClassicEditorUIView( editor.locale );
-					ui = new ClassicEditorUI( editor, view );
-					editable = editor.editing.view.getRoot();
-
-					ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
-					ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
-
-					expect( view.toolbar.viewportTopOffset ).to.equal( 100 );
-
-					editorElement.remove();
-					return editor.destroy();
-				} );
+				return ClassicTestEditor
+					.create( editorElement, {
+						toolbar: {
+							items: [ 'foo', 'bar' ],
+							viewportTopOffset: 100
+						}
+					} )
+					.then( editor => {
+						view = new ClassicEditorUIView( editor.locale );
+						ui = new ClassicEditorUI( editor, view );
+						editable = editor.editing.view.getRoot();
+
+						ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
+						ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
+
+						expect( view.toolbar.viewportTopOffset ).to.equal( 100 );
+
+						editorElement.remove();
+						return editor.destroy();
+					} );
 			} );
 		} );
 
@@ -177,27 +179,28 @@ describe( 'ClassicEditorUI', () => {
 				editorElement = document.createElement( 'div' );
 				document.body.appendChild( editorElement );
 
-				return ClassicTestEditor.create( editorElement, {
-					toolbar: {
-						items: [ 'foo', 'bar' ],
-						viewportTopOffset: 100
-					}
-				} )
-				.then( editor => {
-					view = new ClassicEditorUIView( editor.locale );
-					ui = new ClassicEditorUI( editor, view );
-
-					ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
-					ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
-
-					const spy = testUtils.sinon.spy( view.toolbar, 'fillFromConfig' );
-
-					ui.init();
-					sinon.assert.calledWithExactly( spy,
-						editor.config.get( 'toolbar.items' ),
-						ui.componentFactory
-					);
-				} );
+				return ClassicTestEditor
+					.create( editorElement, {
+						toolbar: {
+							items: [ 'foo', 'bar' ],
+							viewportTopOffset: 100
+						}
+					} )
+					.then( editor => {
+						view = new ClassicEditorUIView( editor.locale );
+						ui = new ClassicEditorUI( editor, view );
+
+						ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
+						ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
+
+						const spy = testUtils.sinon.spy( view.toolbar, 'fillFromConfig' );
+
+						ui.init();
+						sinon.assert.calledWithExactly( spy,
+							editor.config.get( 'toolbar.items' ),
+							ui.componentFactory
+						);
+					} );
 			} );
 		} );
 

+ 18 - 17
packages/ckeditor5-editor-classic/tests/manual/classiceditor.js

@@ -18,23 +18,24 @@ import testUtils from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 let editor, editable, observer;
 
 function initEditor() {
-	ClassicEditor.create( document.querySelector( '#editor' ), {
-		plugins: [ Enter, Typing, Paragraph, Undo, Heading, Bold, Italic ],
-		toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
-	} )
-	.then( newEditor => {
-		console.log( 'Editor was initialized', newEditor );
-		console.log( 'You can now play with it using global `editor` and `editable` variables.' );
-
-		window.editor = editor = newEditor;
-		window.editable = editable = editor.editing.view.getRoot();
-
-		observer = testUtils.createObserver();
-		observer.observe( 'Editable', editable, [ 'isFocused' ] );
-	} )
-	.catch( err => {
-		console.error( err.stack );
-	} );
+	ClassicEditor
+		.create( document.querySelector( '#editor' ), {
+			plugins: [ Enter, Typing, Paragraph, Undo, Heading, Bold, Italic ],
+			toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
+		} )
+		.then( newEditor => {
+			console.log( 'Editor was initialized', newEditor );
+			console.log( 'You can now play with it using global `editor` and `editable` variables.' );
+
+			window.editor = editor = newEditor;
+			window.editable = editable = editor.editing.view.getRoot();
+
+			observer = testUtils.createObserver();
+			observer.observe( 'Editable', editable, [ 'isFocused' ] );
+		} )
+		.catch( err => {
+			console.error( err.stack );
+		} );
 }
 
 function destroyEditor() {

+ 16 - 15
packages/ckeditor5-editor-classic/tests/manual/tickets/60/1.js

@@ -14,19 +14,20 @@ import Undo from '@ckeditor/ckeditor5-undo/src/undo';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 
-ClassicEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ Enter, Typing, Paragraph, Undo, Heading, Bold, Italic ],
-	toolbar: {
-		items: [ 'headings', 'bold', 'italic', 'undo', 'redo' ],
-		viewportTopOffset: 100
-	}
-} )
-.then( newEditor => {
-	console.log( 'Editor was initialized', newEditor );
-	console.log( 'You can now play with it using global `editor` and `editable` variables.' );
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ Enter, Typing, Paragraph, Undo, Heading, Bold, Italic ],
+		toolbar: {
+			items: [ 'headings', 'bold', 'italic', 'undo', 'redo' ],
+			viewportTopOffset: 100
+		}
+	} )
+	.then( newEditor => {
+		console.log( 'Editor was initialized', newEditor );
+		console.log( 'You can now play with it using global `editor` and `editable` variables.' );
 
-	window.editor = newEditor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+		window.editor = newEditor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );