Przeglądaj źródła

Use ClassicTestEditor in the automated tests.

Piotrek Koszuliński 8 lat temu
rodzic
commit
f1b90b7c81

+ 13 - 8
packages/ckeditor5-typing/tests/bogusbr-integration.js

@@ -5,7 +5,8 @@
 
 /* globals document */
 
-import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classic';
+import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
+
 import MutationObserver from '@ckeditor/ckeditor5-engine/src/view/observer/mutationobserver';
 
 import Typing from '../src/typing';
@@ -14,16 +15,14 @@ import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 
 import { setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
-describe( 'Bogus BR Integration', () => {
-	let editor;
-	let domRoot;
-	let mutationObserver;
+describe( 'Bogus BR integration', () => {
+	let editor, domRoot, mutationObserver, editorElement;
 
 	beforeEach( () => {
-		const container = document.createElement( 'div' );
-		document.body.appendChild( container );
+		editorElement = document.createElement( 'div' );
+		document.body.appendChild( editorElement );
 
-		return ClassicEditor.create( container, {
+		return ClassicTestEditor.create( editorElement, {
 			plugins: [ Typing, Paragraph, Bold ]
 		} )
 		.then( newEditor => {
@@ -33,6 +32,12 @@ describe( 'Bogus BR Integration', () => {
 		} );
 	} );
 
+	afterEach( () => {
+		editorElement.remove();
+
+		return editor.destroy();
+	} );
+
 	describe( 'insertText', () => {
 		// Tests using 'insertText' generates same mutations as typing. This means they will behave
 		// a little different in every browser (as native mutations may be different in different browsers).

+ 4 - 2
packages/ckeditor5-typing/tests/inputcommand-integration.js

@@ -22,10 +22,10 @@ import { getData as getModelData } from  '@ckeditor/ckeditor5-engine/src/dev-uti
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
 describe( 'InputCommand integration', () => {
-	let editor, doc, viewDocument, boldView, italicView;
+	let editor, doc, viewDocument, boldView, italicView, editorElement;
 
 	beforeEach( () => {
-		const editorElement = document.createElement( 'div' );
+		editorElement = document.createElement( 'div' );
 		document.body.appendChild( editorElement );
 
 		return ClassicTestEditor.create( editorElement, {
@@ -43,6 +43,8 @@ describe( 'InputCommand integration', () => {
 	} );
 
 	afterEach( () => {
+		editorElement.remove();
+
 		return editor.destroy();
 	} );
 

+ 6 - 6
packages/ckeditor5-typing/tests/manual/52/1.js

@@ -21,9 +21,9 @@ ClassicEditor.create( document.querySelector( '#editor' ), {
 	plugins: [ EssentialsPreset, Paragraph, Bold, Italic, Heading ],
 	toolbar: [ 'headings', 'bold', 'italic', 'undo', 'redo' ]
 } )
-	.then( editor => {
-		window.editor = editor;
-	} )
-	.catch( err => {
-		console.error( err.stack );
-	} );
+.then( editor => {
+	window.editor = editor;
+} )
+.catch( err => {
+	console.error( err.stack );
+} );