Przeglądaj źródła

Code style: Aligned code style to new ESLint version.

Kamil Piechaczek 8 lat temu
rodzic
commit
7a91eb0e61

+ 44 - 38
packages/ckeditor5-editor-inline/tests/inlineeditor.js

@@ -62,12 +62,13 @@ describe( 'InlineEditor', () => {
 
 	describe( 'create()', () => {
 		beforeEach( function() {
-			return InlineEditor.create( editorElement, {
-				plugins: [ Paragraph, Bold ]
-			} )
-			.then( newEditor => {
-				editor = newEditor;
-			} );
+			return InlineEditor
+				.create( editorElement, {
+					plugins: [ Paragraph, Bold ]
+				} )
+				.then( newEditor => {
+					editor = newEditor;
+				} );
 		} );
 
 		afterEach( () => {
@@ -101,19 +102,20 @@ describe( 'InlineEditor', () => {
 
 			class CustomInlineEditor extends InlineEditor {}
 
-			return CustomInlineEditor.create( editorElement, {
-				plugins: [ Paragraph, Bold ]
-			} )
-			.then( newEditor => {
-				expect( newEditor ).to.be.instanceof( CustomInlineEditor );
-				expect( newEditor ).to.be.instanceof( InlineEditor );
+			return CustomInlineEditor
+				.create( editorElement, {
+					plugins: [ Paragraph, Bold ]
+				} )
+				.then( newEditor => {
+					expect( newEditor ).to.be.instanceof( CustomInlineEditor );
+					expect( newEditor ).to.be.instanceof( InlineEditor );
 
-				expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
+					expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
 
-				editorElement.remove();
+					editorElement.remove();
 
-				return newEditor.destroy();
-			} );
+					return newEditor.destroy();
+				} );
 		} );
 	} );
 
@@ -138,14 +140,15 @@ describe( 'InlineEditor', () => {
 				}
 			}
 
-			return InlineEditor.create( editorElement, {
-				plugins: [ EventWatcher ]
-			} )
-			.then( newEditor => {
-				expect( fired ).to.deep.equal( [ 'pluginsReady', 'uiReady', 'dataReady', 'ready' ] );
+			return InlineEditor
+				.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', () => {
@@ -159,14 +162,15 @@ describe( 'InlineEditor', () => {
 				}
 			}
 
-			return InlineEditor.create( editorElement, {
-				plugins: [ EventWatcher, Paragraph, Bold ]
-			} )
-			.then( newEditor => {
-				expect( data ).to.equal( '<p><strong>foo</strong> bar</p>' );
+			return InlineEditor
+				.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', () => {
@@ -180,20 +184,22 @@ describe( 'InlineEditor', () => {
 				}
 			}
 
-			return InlineEditor.create( editorElement, {
-				plugins: [ EventWatcher ]
-			} )
-			.then( newEditor => {
-				expect( isReady ).to.be.true;
+			return InlineEditor
+				.create( editorElement, {
+					plugins: [ EventWatcher ]
+				} )
+				.then( newEditor => {
+					expect( isReady ).to.be.true;
 
-				editor = newEditor;
-			} );
+					editor = newEditor;
+				} );
 		} );
 	} );
 
 	describe( 'destroy', () => {
 		beforeEach( function() {
-			return InlineEditor.create( editorElement, { plugins: [ Paragraph ] } )
+			return InlineEditor
+				.create( editorElement, { plugins: [ Paragraph ] } )
 				.then( newEditor => {
 					editor = newEditor;
 

+ 56 - 53
packages/ckeditor5-editor-inline/tests/inlineeditorui.js

@@ -27,19 +27,20 @@ describe( 'InlineEditorUI', () => {
 		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
-		return ClassicTestEditor.create( editorElement, {
-			toolbar: [ 'foo', 'bar' ]
-		} )
-		.then( newEditor => {
-			editor = newEditor;
-
-			view = new InlineEditorUIView( editor.locale );
-			ui = new InlineEditorUI( 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' ]
+			} )
+			.then( newEditor => {
+				editor = newEditor;
+
+				view = new InlineEditorUIView( editor.locale );
+				ui = new InlineEditorUI( editor, view );
+				editable = editor.editing.view.getRoot();
+
+				ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
+				ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
+			} );
 	} );
 
 	afterEach( () => {
@@ -81,25 +82,26 @@ describe( 'InlineEditorUI', () => {
 				editorElement = document.createElement( 'div' );
 				document.body.appendChild( editorElement );
 
-				return ClassicTestEditor.create( editorElement, {
-					toolbar: {
-						items: [ 'foo', 'bar' ],
-						viewportTopOffset: 100
-					}
-				} )
-				.then( editor => {
-					view = new InlineEditorUIView( editor.locale );
-					ui = new InlineEditorUI( editor, view );
-					editable = editor.editing.view.getRoot();
-
-					ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
-					ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
-
-					expect( view.viewportTopOffset ).to.equal( 100 );
-
-					editorElement.remove();
-					return editor.destroy();
-				} );
+				return ClassicTestEditor
+					.create( editorElement, {
+						toolbar: {
+							items: [ 'foo', 'bar' ],
+							viewportTopOffset: 100
+						}
+					} )
+					.then( editor => {
+						view = new InlineEditorUIView( editor.locale );
+						ui = new InlineEditorUI( editor, view );
+						editable = editor.editing.view.getRoot();
+
+						ui.componentFactory.add( 'foo', viewCreator( 'foo' ) );
+						ui.componentFactory.add( 'bar', viewCreator( 'bar' ) );
+
+						expect( view.viewportTopOffset ).to.equal( 100 );
+
+						editorElement.remove();
+						return editor.destroy();
+					} );
 			} );
 
 			// https://github.com/ckeditor/ckeditor5-editor-inline/issues/4
@@ -182,27 +184,28 @@ describe( 'InlineEditorUI', () => {
 				editorElement = document.createElement( 'div' );
 				document.body.appendChild( editorElement );
 
-				return ClassicTestEditor.create( editorElement, {
-					toolbar: {
-						items: [ 'foo', 'bar' ],
-						viewportTopOffset: 100
-					}
-				} )
-				.then( editor => {
-					view = new InlineEditorUIView( editor.locale );
-					ui = new InlineEditorUI( 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 InlineEditorUIView( editor.locale );
+						ui = new InlineEditorUI( 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
+						);
+					} );
 			} );
 		} );
 

+ 21 - 20
packages/ckeditor5-editor-inline/tests/manual/inlineeditor.js

@@ -18,30 +18,31 @@ function initEditors() {
 	init( '#editor-2' );
 
 	function init( selector ) {
-		InlineEditor.create( document.querySelector( selector ), {
-			plugins: [ ArticlePreset ],
-			toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ]
-		} )
-		.then( editor => {
-			console.log( `${ selector } has been initialized`, editor );
-			console.log( 'It has been added to global `editors` and `editables`.' );
+		InlineEditor
+			.create( document.querySelector( selector ), {
+				plugins: [ ArticlePreset ],
+				toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ]
+			} )
+			.then( editor => {
+				console.log( `${ selector } has been initialized`, editor );
+				console.log( 'It has been added to global `editors` and `editables`.' );
 
-			window.editors[ selector ] = editor;
-			window.editables.push( editor.editing.view.getRoot() );
+				window.editors[ selector ] = editor;
+				window.editables.push( editor.editing.view.getRoot() );
 
-			const observer = testUtils.createObserver();
+				const observer = testUtils.createObserver();
 
-			observer.observe(
-				`${ selector }.ui.focusTracker`,
-				editor.ui.focusTracker,
-				[ 'isFocused' ]
-			);
+				observer.observe(
+					`${ selector }.ui.focusTracker`,
+					editor.ui.focusTracker,
+					[ 'isFocused' ]
+				);
 
-			window._observers.push( observer );
-		} )
-		.catch( err => {
-			console.error( err.stack );
-		} );
+				window._observers.push( observer );
+			} )
+			.catch( err => {
+				console.error( err.stack );
+			} );
 	}
 }
 

+ 16 - 15
packages/ckeditor5-editor-inline/tests/manual/tickets/23/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';
 
-InlineEditor.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.' );
+InlineEditor
+	.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 );
+	} );

+ 11 - 10
packages/ckeditor5-editor-inline/tests/manual/tickets/4/1.js

@@ -8,13 +8,14 @@
 import InlineEditor from '../../../../src/inlineeditor';
 import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
 
-InlineEditor.create( document.querySelector( '#editor' ), {
-	plugins: [ ArticlePreset ],
-	toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ]
-} )
-.then( editor => {
-	window.editor = editor;
-} )
-.catch( err => {
-	console.error( err.stack );
-} );
+InlineEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ ArticlePreset ],
+		toolbar: [ 'headings', 'bold', 'italic', 'link', 'unlink', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );