8
0
Просмотр исходного кода

Merge pull request #97 from ckeditor/i/6002

Tests: Fixed tests leaking editor instances / DOM elements. See ckeditor/ckeditor5#6002.
Kamil Piechaczek 6 лет назад
Родитель
Сommit
8647dbdabe

+ 4 - 2
packages/ckeditor5-basic-styles/tests/bold/boldui.js

@@ -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
@@ -34,6 +34,8 @@ describe( 'BoldUI', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );
 

+ 4 - 2
packages/ckeditor5-basic-styles/tests/code/codeui.js

@@ -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
@@ -34,6 +34,8 @@ describe( 'CodeUI', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );
 

+ 4 - 2
packages/ckeditor5-basic-styles/tests/italic/italicui.js

@@ -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
@@ -35,6 +35,8 @@ describe( 'ItalicUI', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );
 

+ 4 - 2
packages/ckeditor5-basic-styles/tests/strikethrough/strikethroughui.js

@@ -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
@@ -35,6 +35,8 @@ describe( 'StrikethroughUI', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );
 

+ 4 - 2
packages/ckeditor5-basic-styles/tests/subscript/subscriptui.js

@@ -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
@@ -34,6 +34,8 @@ describe( 'SubscriptUI', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );
 

+ 4 - 2
packages/ckeditor5-basic-styles/tests/superscript/superscriptui.js

@@ -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
@@ -34,6 +34,8 @@ describe( 'SuperscriptUI', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );
 

+ 4 - 2
packages/ckeditor5-basic-styles/tests/underline/underlineui.js

@@ -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
@@ -35,6 +35,8 @@ describe( 'Underline', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );