Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Code refactorin in the editor-inline package.
Browse files Browse the repository at this point in the history
Internal: Aligned the UI to the latest API of the framework (see ckeditor/ckeditor5-ui#262).
  • Loading branch information
oleq authored and oskarwrobel committed Nov 2, 2017
1 parent 45ab8e5 commit ef54562
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 38 deletions.
6 changes: 2 additions & 4 deletions src/inlineeditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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,
Expand Down
50 changes: 16 additions & 34 deletions tests/inlineeditorui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
} );
Expand Down Expand Up @@ -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;
} );
Expand Down

0 comments on commit ef54562

Please sign in to comment.