瀏覽代碼

Tests: Cleaned up the document.body after various UI components' tests.

Aleksander Nowodzinski 8 年之前
父節點
當前提交
c252b23b37

+ 4 - 0
packages/ckeditor5-ui/tests/dropdown/list/createlistdropdown.js

@@ -30,6 +30,10 @@ describe( 'createListDropdown', () => {
 		document.body.appendChild( view.element );
 	} );
 
+	afterEach( () => {
+		view.element.remove();
+	} );
+
 	describe( 'constructor()', () => {
 		it( 'sets view#locale', () => {
 			expect( view.locale ).to.equal( locale );

+ 4 - 0
packages/ckeditor5-ui/tests/editorui/boxed/boxededitoruiview.js

@@ -16,6 +16,10 @@ describe( 'BoxedEditorUIView', () => {
 		element = view.element;
 	} );
 
+	afterEach( () => {
+		view.destroy();
+	} );
+
 	describe( 'constructor()', () => {
 		it( 'adds view collections', () => {
 			expect( view.top ).to.be.instanceof( ViewCollection );

+ 5 - 1
packages/ckeditor5-ui/tests/editorui/editoruiview.js

@@ -22,6 +22,10 @@ describe( 'EditorUIView', () => {
 		view.render();
 	} );
 
+	afterEach( () => {
+		view.destroy();
+	} );
+
 	describe( 'constructor()', () => {
 		it( 'accepts locale', () => {
 			expect( view.locale ).to.equal( locale );
@@ -32,7 +36,7 @@ describe( 'EditorUIView', () => {
 		} );
 	} );
 
-	describe( 'init()', () => {
+	describe( 'render()', () => {
 		it( 'sets the right class set to the body region', () => {
 			const el = view._bodyCollectionContainer;
 

+ 10 - 1
packages/ckeditor5-ui/tests/iframe/iframeview.js

@@ -18,6 +18,8 @@ describe( 'IframeView', () => {
 
 			expect( view.element.classList.contains( 'ck-reset_all' ) ).to.be.true;
 			expect( view.element.attributes.getNamedItem( 'sandbox' ).value ).to.equal( 'allow-same-origin allow-scripts' );
+
+			view.element.remove();
 		} );
 	} );
 
@@ -34,6 +36,8 @@ describe( 'IframeView', () => {
 			const promise = view.render()
 				.then( () => {
 					expect( view.element.contentDocument.readyState ).to.equal( 'complete' );
+
+					view.element.remove();
 				} );
 
 			// Moving iframe into DOM trigger creation of a document inside iframe.
@@ -47,7 +51,12 @@ describe( 'IframeView', () => {
 		it( 'is fired when frame finished loading', done => {
 			view = new IframeView();
 
-			view.on( 'loaded', () => done() );
+			view.on( 'loaded', () => {
+				view.element.remove();
+
+				done();
+			} );
+
 			view.render();
 
 			// Moving iframe into DOM trigger creation of a document inside iframe.

+ 1 - 0
packages/ckeditor5-ui/tests/panel/balloon/contextualballoon.js

@@ -54,6 +54,7 @@ describe( 'ContextualBalloon', () => {
 
 	afterEach( () => {
 		editor.destroy();
+		editorElement.remove();
 	} );
 
 	it( 'should create a plugin instance', () => {

+ 4 - 0
packages/ckeditor5-ui/tests/panel/sticky/stickypanelview.js

@@ -45,6 +45,10 @@ describe( 'StickyPanelView', () => {
 		document.body.appendChild( element );
 	} );
 
+	afterEach( () => {
+		element.remove();
+	} );
+
 	describe( 'constructor()', () => {
 		it( 'inherits from View', () => {
 			expect( view ).to.be.instanceof( View );