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

Commit

Permalink
Tests: Simplified DecoupledEditor tests to avoid unexpected crashes o…
Browse files Browse the repository at this point in the history
…f Firefox.
  • Loading branch information
oleq committed Mar 29, 2018
1 parent 63683b6 commit f0898b0
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions tests/decouplededitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,7 @@ describe( 'DecoupledEditor', () => {
} );

describe( 'create()', () => {
afterEach( () => {
return editor.destroy();
} );

describe( 'editor with data', () => {
beforeEach( () => {
return DecoupledEditor
.create( editorData, {
plugins: [ Paragraph, Bold ]
} )
.then( newEditor => {
editor = newEditor;
} );
} );

test( () => editorData );
} );

Expand All @@ -81,26 +67,34 @@ describe( 'DecoupledEditor', () => {
beforeEach( () => {
editableElement = document.createElement( 'div' );
editableElement.innerHTML = editorData;

return DecoupledEditor
.create( editableElement, {
plugins: [ Paragraph, Bold ]
} )
.then( newEditor => {
editor = newEditor;
} );
} );

test( () => editableElement );
} );

function test( getElementOrData ) {
it( 'creates an instance which inherits from the DecoupledEditor', () => {
expect( editor ).to.be.instanceof( DecoupledEditor );
return DecoupledEditor
.create( getElementOrData(), {
plugins: [ Paragraph, Bold ]
} )
.then( newEditor => {
expect( newEditor ).to.be.instanceof( DecoupledEditor );

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

it( 'loads the initial data', () => {
expect( editor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );
return DecoupledEditor
.create( getElementOrData(), {
plugins: [ Paragraph, Bold ]
} )
.then( newEditor => {
expect( newEditor.getData() ).to.equal( '<p><strong>foo</strong> bar</p>' );

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

// https://github.com/ckeditor/ckeditor5-editor-classic/issues/53
Expand Down

0 comments on commit f0898b0

Please sign in to comment.