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

Commit

Permalink
Merge pull request #22 from alexeckermann/t/ckeditor5/1150
Browse files Browse the repository at this point in the history
Internal: Ensured the `BalloonEditorUIView` is rendered correctly and its children are added in `#render()` instead of `#constructor()` (see ckeditor/ckeditor5#1150).

Huge thanks to [Alex Eckermann](https://github.com/alexeckermann) for this contribution!
  • Loading branch information
oleq authored Jul 26, 2018
2 parents 4ff60a3 + 8f73868 commit 91fd136
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions src/ballooneditoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export default class BalloonEditorUIView extends EditorUIView {
* @member {module:ui/editableui/inline/inlineeditableuiview~InlineEditableUIView}
*/
this.editable = new InlineEditableUIView( locale, editableElement );
}

/**
* @inheritDoc
*/
render() {
super.render();

this.registerChild( this.editable );
}
Expand Down
18 changes: 12 additions & 6 deletions tests/ballooneditoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,22 @@ describe( 'BalloonEditorUIView', () => {
expect( view.editable.locale ).to.equal( locale );
} );

it( 'is registered as a child', () => {
const spy = sinon.spy( view.editable, 'destroy' );

view.render();
view.destroy();
sinon.assert.calledOnce( spy );
it( 'is not rendered', () => {
expect( view.editable.isRendered ).to.be.false;
} );
} );
} );

describe( 'render()', () => {
it( 'editable is registered as a child', () => {
const spy = sinon.spy( view.editable, 'destroy' );

view.render();
view.destroy();
sinon.assert.calledOnce( spy );
} );
} );

describe( 'editableElement', () => {
it( 'returns editable\'s view element', () => {
view.render();
Expand Down

0 comments on commit 91fd136

Please sign in to comment.