Browse Source

Code refactoring in InlineEditorUI class.

Aleksander Nowodzinski 8 years ago
parent
commit
5480a43fc1

+ 10 - 10
packages/ckeditor5-editor-inline/src/inlineeditorui.js

@@ -52,6 +52,16 @@ export default class InlineEditorUI {
 		 * @private
 		 */
 		this._toolbarConfig = normalizeToolbarConfig( editor.config.get( 'toolbar' ) );
+	}
+
+	/**
+	 * Initializes the UI.
+	 */
+	init() {
+		const editor = this.editor;
+		const view = this.view;
+
+		view.render();
 
 		// Set–up the view#panel.
 		view.panel.bind( 'isVisible' ).to( this.focusTracker, 'isFocused' );
@@ -82,16 +92,6 @@ export default class InlineEditorUI {
 		view.editable.name = editingRoot.rootName;
 
 		this.focusTracker.add( view.editableElement );
-	}
-
-	/**
-	 * Initializes the UI.
-	 */
-	init() {
-		const editor = this.editor;
-		const view = this.view;
-
-		view.render();
 
 		if ( this._toolbarConfig ) {
 			view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory );

+ 4 - 0
packages/ckeditor5-editor-inline/tests/inlineeditor.js

@@ -42,7 +42,11 @@ describe( 'InlineEditor', () => {
 		} );
 
 		it( 'creates a single div editable root in the view', () => {
+			editor.ui.init();
+
 			expect( editor.editing.view.getRoot() ).to.have.property( 'name', 'div' );
+
+			editor.ui.destroy();
 		} );
 
 		it( 'creates a single document root', () => {