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

Fixed tests leaking editor instance / DOM element #97

Merged
merged 3 commits into from
Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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