diff --git a/src/inlineeditorui.js b/src/inlineeditorui.js index 0414b6c..91fab03 100644 --- a/src/inlineeditorui.js +++ b/src/inlineeditorui.js @@ -66,7 +66,7 @@ export default class InlineEditorUI { // Set–up the view#panel. view.panel.bind( 'isVisible' ).to( this.focusTracker, 'isFocused' ); - if ( this._toolbarConfig && this._toolbarConfig.viewportTopOffset ) { + if ( this._toolbarConfig.viewportTopOffset ) { view.viewportTopOffset = this._toolbarConfig.viewportTopOffset; } @@ -93,9 +93,7 @@ export default class InlineEditorUI { this.focusTracker.add( view.editableElement ); - if ( this._toolbarConfig ) { - view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory ); - } + view.toolbar.fillFromConfig( this._toolbarConfig.items, this.componentFactory ); enableToolbarKeyboardFocus( { origin: editor.editing.view, diff --git a/tests/inlineeditorui.js b/tests/inlineeditorui.js index d89d3c5..a0c01a6 100644 --- a/tests/inlineeditorui.js +++ b/tests/inlineeditorui.js @@ -23,24 +23,24 @@ testUtils.createSinonSandbox(); describe( 'InlineEditorUI', () => { let editor, view, ui; - describe( 'constructor()', () => { - beforeEach( () => { - return VirtualInlineTestEditor - .create( { - toolbar: [ 'foo', 'bar' ], - } ) - .then( newEditor => { - editor = newEditor; - - ui = editor.ui; - view = ui.view; - } ); - } ); + beforeEach( () => { + return VirtualInlineTestEditor + .create( { + toolbar: [ 'foo', 'bar' ], + } ) + .then( newEditor => { + editor = newEditor; + + ui = editor.ui; + view = ui.view; + } ); + } ); - afterEach( () => { - editor.destroy(); - } ); + afterEach( () => { + editor.destroy(); + } ); + describe( 'constructor()', () => { it( 'sets #editor', () => { expect( ui.editor ).to.equal( editor ); } ); @@ -150,24 +150,6 @@ describe( 'InlineEditorUI', () => { } ); describe( 'init()', () => { - beforeEach( () => { - return VirtualInlineTestEditor - .create( { - toolbar: [ 'foo', 'bar' ], - } ) - .then( newEditor => { - editor = newEditor; - - ui = editor.ui; - view = ui.view; - } ); - } ); - - afterEach( () => { - ui.destroy(); - editor.destroy(); - } ); - it( 'renders the #view', () => { expect( view.isRendered ).to.be.true; } );