Kaynağa Gözat

Aligned test editors with changes in Editor class.

Oskar Wróbel 8 yıl önce
ebeveyn
işleme
51033d487e

+ 0 - 7
packages/ckeditor5-core/tests/_utils-tests/classictesteditor.js

@@ -37,13 +37,6 @@ describe( 'ClassicTestEditor', () => {
 			expect( editor.element ).to.equal( editorElement );
 			expect( editor.ui ).to.be.instanceOf( ClassicTestEditorUI );
 			expect( editor.ui.view ).to.be.instanceOf( BoxedEditorUIView );
-		} );
-
-		it( 'creates model and view roots', () => {
-			const editor = new ClassicTestEditor( editorElement );
-
-			expect( editor.model.document.getRoot() ).to.have.property( 'name', '$root' );
-			expect( editor.editing.view.getRoot() ).to.have.property( 'name', 'div' );
 			expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
 		} );
 

+ 10 - 3
packages/ckeditor5-core/tests/_utils-tests/modeltesteditor.js

@@ -21,15 +21,22 @@ describe( 'ModelTestEditor', () => {
 			const editor = new ModelTestEditor( { foo: 1 } );
 
 			expect( editor ).to.be.instanceof( Editor );
-
 			expect( editor.config.get( 'foo' ) ).to.equal( 1 );
+			expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
 		} );
 
-		it( 'creates model and view roots', () => {
+		it( 'creates model root', () => {
 			const editor = new ModelTestEditor( { foo: 1 } );
 
 			expect( editor.model.document.getRoot() ).to.have.property( 'name', '$root' );
-			expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
+		} );
+
+		it( 'should disable editing pipeline and clear main root', () => {
+			const editor = new ModelTestEditor( { foo: 1 } );
+
+			editor.model.document.createRoot( 'second', 'second' );
+
+			expect( Array.from( editor.editing.view.roots ) ).to.length( 0 );
 		} );
 	} );
 

+ 0 - 2
packages/ckeditor5-core/tests/_utils/classictesteditor.js

@@ -23,8 +23,6 @@ export default class ClassicTestEditor extends StandardEditor {
 	constructor( element, config ) {
 		super( element, config );
 
-		this.model.document.createRoot();
-		this.editing.createRoot( 'div' );
 		this.data.processor = new HtmlDataProcessor();
 
 		this.ui = new ClassicTestEditorUI( this, new BoxedEditorUIView( this.locale ) );

+ 4 - 2
packages/ckeditor5-core/tests/_utils/modeltesteditor.js

@@ -18,9 +18,11 @@ export default class ModelTestEditor extends Editor {
 	constructor( config ) {
 		super( config );
 
-		this.model.document.createRoot();
-
 		this.data.processor = new HtmlDataProcessor();
+
+		// Disable editing pipeline for model editor.
+		this.editing.destroy();
+		this.editing.view.roots.clear();
 	}
 
 	/**

+ 4 - 4
packages/ckeditor5-core/tests/_utils/virtualtesteditor.js

@@ -18,11 +18,11 @@ export default class VirtualTestEditor extends StandardEditor {
 	constructor( config ) {
 		super( null, config );
 
-		this.model.document.createRoot();
-
-		this.editing.createRoot( 'div' );
-
 		this.data.processor = new HtmlDataProcessor();
+
+		// Lets change view root element name from $root to div.
+		// This will look more friendly in view tests.
+		this.editing.view.getRoot().name = 'div';
 	}
 
 	/**