Browse Source

Tests: Fixed tests leaking editor instance / DOM element.

Marek Lewandowski 6 years ago
parent
commit
4495173bce
1 changed files with 10 additions and 0 deletions
  1. 10 0
      packages/ckeditor5-editor-decoupled/tests/decouplededitor.js

+ 10 - 0
packages/ckeditor5-editor-decoupled/tests/decouplededitor.js

@@ -186,8 +186,18 @@ describe( 'DecoupledEditor', () => {
 						);
 					}
 				)
+				.then( () => {
+					removeEditorDom();
+				} )
 				.then( done )
 				.catch( done );
+
+			function removeEditorDom() {
+				// Remove DOM leftovers to not affect other tests (#6002, #6018).
+				for ( const editorBody of document.body.querySelectorAll( 'div.ck.ck-body' ) ) {
+					editorBody.remove();
+				}
+			}
 		} );
 
 		it( 'throws error if it is initialized in textarea', done => {