Skip to content

Commit

Permalink
Restore and fix test for check initial data. Check if setData() wasn'…
Browse files Browse the repository at this point in the history
…t invoked.
  • Loading branch information
elszczepano committed Apr 18, 2019
1 parent 9b557ca commit 1ce9387
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/_utils/mockeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class MockEditor {
this.element = el;
this.config = config;
this.data = '';
this.setDataCounter = 0;

this.model = {
document: new ModelDocument()
Expand All @@ -39,6 +40,7 @@ export default class MockEditor {
}

setData( data ) {
this.setDataCounter++;
this.data = data;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ describe( 'CKEditor Component', () => {
expect( vm.value ).to.equal( '' );
} );

it( 'should set the initial data by using innerHTML, not by "setData()"', done => {
const { wrapper, vm } = createComponent( {
value: 'foo'
} );

Vue.nextTick( () => {

expect( vm.$el.innerHTML ).to.equal( 'foo' );
expect( vm.instance.setDataCounter).to.equal(0);

wrapper.destroy();
done();
} );
} );
} );

describe( '#tagName', () => {
Expand Down

0 comments on commit 1ce9387

Please sign in to comment.