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 #97 from ckeditor/i/6002
Browse files Browse the repository at this point in the history
Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
  • Loading branch information
pomek authored Jan 7, 2020
2 parents 4c895ed + cac0229 commit bde751e
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 14 deletions.
6 changes: 4 additions & 2 deletions tests/bold/boldui.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

describe( 'BoldUI', () => {
let editor, boldView;
let editor, boldView, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
const editorElement = document.createElement( 'div' );
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );

return ClassicTestEditor
Expand All @@ -34,6 +34,8 @@ describe( 'BoldUI', () => {
} );

afterEach( () => {
editorElement.remove();

return editor.destroy();
} );

Expand Down
6 changes: 4 additions & 2 deletions tests/code/codeui.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

describe( 'CodeUI', () => {
let editor, codeView;
let editor, codeView, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
const editorElement = document.createElement( 'div' );
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );

return ClassicTestEditor
Expand All @@ -34,6 +34,8 @@ describe( 'CodeUI', () => {
} );

afterEach( () => {
editorElement.remove();

return editor.destroy();
} );

Expand Down
6 changes: 4 additions & 2 deletions tests/italic/italicui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

describe( 'ItalicUI', () => {
let editor, italicView;
let editor, italicView, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
const editorElement = document.createElement( 'div' );
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );

return ClassicTestEditor
Expand All @@ -35,6 +35,8 @@ describe( 'ItalicUI', () => {
} );

afterEach( () => {
editorElement.remove();

return editor.destroy();
} );

Expand Down
6 changes: 4 additions & 2 deletions tests/strikethrough/strikethroughui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

describe( 'StrikethroughUI', () => {
let editor, strikeView;
let editor, strikeView, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
const editorElement = document.createElement( 'div' );
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );

return ClassicTestEditor
Expand All @@ -35,6 +35,8 @@ describe( 'StrikethroughUI', () => {
} );

afterEach( () => {
editorElement.remove();

return editor.destroy();
} );

Expand Down
6 changes: 4 additions & 2 deletions tests/subscript/subscriptui.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

describe( 'SubscriptUI', () => {
let editor, subView;
let editor, subView, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
const editorElement = document.createElement( 'div' );
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );

return ClassicTestEditor
Expand All @@ -34,6 +34,8 @@ describe( 'SubscriptUI', () => {
} );

afterEach( () => {
editorElement.remove();

return editor.destroy();
} );

Expand Down
6 changes: 4 additions & 2 deletions tests/superscript/superscriptui.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

describe( 'SuperscriptUI', () => {
let editor, superView;
let editor, superView, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
const editorElement = document.createElement( 'div' );
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );

return ClassicTestEditor
Expand All @@ -34,6 +34,8 @@ describe( 'SuperscriptUI', () => {
} );

afterEach( () => {
editorElement.remove();

return editor.destroy();
} );

Expand Down
6 changes: 4 additions & 2 deletions tests/underline/underlineui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';

describe( 'Underline', () => {
let editor, underlineView;
let editor, underlineView, editorElement;

testUtils.createSinonSandbox();

beforeEach( () => {
const editorElement = document.createElement( 'div' );
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );

return ClassicTestEditor
Expand All @@ -35,6 +35,8 @@ describe( 'Underline', () => {
} );

afterEach( () => {
editorElement.remove();

return editor.destroy();
} );

Expand Down

0 comments on commit bde751e

Please sign in to comment.