From fdc7c1fb21e6d3dd8508ee6d783904f092679167 Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Fri, 20 Dec 2019 04:21:03 +0100 Subject: [PATCH] Tests: Fixed tests leaking editor instance / DOM element. --- tests/input.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/input.js b/tests/input.js index 8f862e3..7247808 100644 --- a/tests/input.js +++ b/tests/input.js @@ -29,14 +29,14 @@ import env from '@ckeditor/ckeditor5-utils/src/env'; /* global document */ describe( 'Input feature', () => { - let editor, model, modelRoot, view, viewDocument, viewRoot, listenter; + let editor, model, modelRoot, view, viewDocument, viewRoot, listenter, domElement; testUtils.createSinonSandbox(); beforeEach( () => { listenter = Object.create( EmitterMixin ); - const domElement = document.createElement( 'div' ); + domElement = document.createElement( 'div' ); document.body.appendChild( domElement ); return ClassicTestEditor.create( domElement, { plugins: [ Input, Paragraph, Bold, Italic, List, ShiftEnter, Link ] } ) @@ -66,6 +66,7 @@ describe( 'Input feature', () => { afterEach( () => { listenter.stopListening(); + domElement.remove(); return editor.destroy(); } ); @@ -1022,7 +1023,7 @@ describe( 'Input feature', () => { } ); describe( 'Input feature - Android', () => { - let editor, model, modelRoot, view, viewDocument, listenter, oldEnvIsAndroid; + let editor, model, modelRoot, view, viewDocument, listenter, oldEnvIsAndroid, domElement; testUtils.createSinonSandbox(); @@ -1034,7 +1035,7 @@ describe( 'Input feature - Android', () => { beforeEach( () => { listenter = Object.create( EmitterMixin ); - const domElement = document.createElement( 'div' ); + domElement = document.createElement( 'div' ); document.body.appendChild( domElement ); return ClassicTestEditor.create( domElement, { plugins: [ Input, Paragraph, Bold, Italic, List, ShiftEnter, Link ] } ) @@ -1055,6 +1056,7 @@ describe( 'Input feature - Android', () => { afterEach( () => { listenter.stopListening(); + domElement.remove(); return editor.destroy(); } );