Ver código fonte

Tests: Fixed broken tests due to double editor destruction.

Aleksander Nowodzinski 6 anos atrás
pai
commit
c1ca6c9172

+ 6 - 12
packages/ckeditor5-editor-classic/tests/classiceditorui.js

@@ -118,13 +118,11 @@ describe( 'ClassicEditorUI', () => {
 						placeholder: 'placeholder-text',
 					} )
 					.then( newEditor => {
-						editor = newEditor;
-
-						const firstChild = editor.editing.view.document.getRoot().getChild( 0 );
+						const firstChild = newEditor.editing.view.document.getRoot().getChild( 0 );
 
 						expect( firstChild.getAttribute( 'data-placeholder' ) ).to.equal( 'placeholder-text' );
 
-						return editor.destroy();
+						return newEditor.destroy();
 					} );
 			} );
 
@@ -138,13 +136,11 @@ describe( 'ClassicEditorUI', () => {
 						extraPlugins: [ Paragraph ]
 					} )
 					.then( newEditor => {
-						editor = newEditor;
-
-						const firstChild = editor.editing.view.document.getRoot().getChild( 0 );
+						const firstChild = newEditor.editing.view.document.getRoot().getChild( 0 );
 
 						expect( firstChild.getAttribute( 'data-placeholder' ) ).to.equal( 'placeholder-text' );
 
-						return editor.destroy();
+						return newEditor.destroy();
 					} );
 			} );
 
@@ -159,13 +155,11 @@ describe( 'ClassicEditorUI', () => {
 						extraPlugins: [ Paragraph ]
 					} )
 					.then( newEditor => {
-						editor = newEditor;
-
-						const firstChild = editor.editing.view.document.getRoot().getChild( 0 );
+						const firstChild = newEditor.editing.view.document.getRoot().getChild( 0 );
 
 						expect( firstChild.getAttribute( 'data-placeholder' ) ).to.equal( 'config takes precedence' );
 
-						return editor.destroy();
+						return newEditor.destroy();
 					} );
 			} );
 		} );