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

Commit

Permalink
Tests: Code refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Jul 22, 2019
1 parent b9681ca commit d9d8c63
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions tests/decouplededitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,23 @@ describe( 'DecoupledEditor', () => {
} );

// See: https://github.com/ckeditor/ckeditor5/issues/746
it( 'should throw when trying to create the editor using the same source element more than once', () => {
it( 'should throw when trying to create the editor using the same source element more than once', done => {
const sourceElement = document.createElement( 'div' );
let editor;

return DecoupledEditor.create( sourceElement )
.then( newEditor => {
editor = newEditor;

return new DecoupledEditor( sourceElement );
} )
.then( () => {
expect.fail( 'Decoupled editor should not initialize on an element already used by other instance.' );
} )
.catch( err => {
assertCKEditorError( err, /^editor-source-element-used-more-than-once/ );
} )
.finally( () => {
return editor.destroy();
} );

// eslint-disable-next-line no-new
new DecoupledEditor( sourceElement );

DecoupledEditor.create( sourceElement )
.then(
() => {
expect.fail( 'Decoupled editor should not initialize on an element already used by other instance.' );
},
err => {
assertCKEditorError( err, /^securesourceelement-element-used-more-than-once/ );
}
)
.then( done )
.catch( done );
} );

it( 'throws if initial data is passed in Editor#create and config.initialData is also used', done => {
Expand Down

0 comments on commit d9d8c63

Please sign in to comment.