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

Commit

Permalink
Merge 8d1ad8b into 5dde661
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Mar 13, 2018
2 parents 5dde661 + 8d1ad8b commit 634ea47
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/decouplededitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default class DecoupledEditor extends Editor {
editor.fire( 'uiReady' );
} )
.then( () => editor.editing.view.attachDomRoot( editor.ui.view.editableElement ) )
.then( () => editor.data.set( data ) )
.then( () => editor.data.init( data ) )
.then( () => {
editor.fire( 'dataReady' );
editor.fire( 'ready' );
Expand Down
27 changes: 27 additions & 0 deletions tests/decouplededitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,33 @@ describe( 'DecoupledEditor', () => {
} );
} );

// https://github.com/ckeditor/ckeditor5-editor-decoupled/issues/3
it( 'initializes the data controller', () => {
let dataInitSpy;

class DataInitAssertPlugin extends Plugin {
constructor( editor ) {
super();

this.editor = editor;
}

init() {
dataInitSpy = sinon.spy( this.editor.data, 'init' );
}
}

return DecoupledEditor
.create( editorData, {
plugins: [ Paragraph, Bold, DataInitAssertPlugin ]
} )
.then( newEditor => {
sinon.assert.calledOnce( dataInitSpy );

return newEditor.destroy();
} );
} );

describe( 'ui', () => {
it( 'attaches editable UI as view\'s DOM root', () => {
expect( editor.editing.view.getDomRoot() ).to.equal( editor.ui.view.editable.element );
Expand Down

0 comments on commit 634ea47

Please sign in to comment.