Przeglądaj źródła

Aligned tests to engine changes.

Oskar Wróbel 8 lat temu
rodzic
commit
d50cf70362

+ 1 - 1
packages/ckeditor5-core/src/editor/editor.js

@@ -171,7 +171,7 @@ export default class Editor {
 
 		return this.plugins.destroy()
 			.then( () => {
-				this.model.document.destroy();
+				this.model.destroy();
 				this.data.destroy();
 			} );
 	}

+ 3 - 3
packages/ckeditor5-core/tests/_utils-tests/classictesteditor.js

@@ -42,7 +42,7 @@ describe( 'ClassicTestEditor', () => {
 		it( 'creates model and view roots', () => {
 			const editor = new ClassicTestEditor( editorElement );
 
-			expect( editor.document.getRoot() ).to.have.property( 'name', '$root' );
+			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 );
 		} );
@@ -81,13 +81,13 @@ describe( 'ClassicTestEditor', () => {
 
 			class PluginTextInRoot extends Plugin {
 				init() {
-					this.editor.document.schema.allow( { name: '$text', inside: '$root' } );
+					this.editor.model.schema.allow( { name: '$text', inside: '$root' } );
 				}
 			}
 
 			return ClassicTestEditor.create( editorElement, { plugins: [ PluginTextInRoot ] } )
 				.then( editor => {
-					expect( getData( editor.document, { withoutSelection: true } ) ).to.equal( 'foo' );
+					expect( getData( editor.model, { withoutSelection: true } ) ).to.equal( 'foo' );
 				} );
 		} );
 

+ 6 - 6
packages/ckeditor5-core/tests/_utils-tests/modeltesteditor.js

@@ -28,7 +28,7 @@ describe( 'ModelTestEditor', () => {
 		it( 'creates model and view roots', () => {
 			const editor = new ModelTestEditor( { foo: 1 } );
 
-			expect( editor.document.getRoot() ).to.have.property( 'name', '$root' );
+			expect( editor.model.document.getRoot() ).to.have.property( 'name', '$root' );
 			expect( editor.data.processor ).to.be.instanceof( HtmlDataProcessor );
 		} );
 	} );
@@ -76,16 +76,16 @@ describe( 'ModelTestEditor', () => {
 				.then( newEditor => {
 					editor = newEditor;
 
-					editor.document.schema.allow( { name: '$text', inside: '$root' } );
+					editor.model.schema.allow( { name: '$text', inside: '$root' } );
 				} );
 		} );
 
 		it( 'should set data of the first root', () => {
-			editor.document.createRoot( '$root', 'secondRoot' );
+			editor.model.document.createRoot( '$root', 'secondRoot' );
 
 			editor.setData( 'foo' );
 
-			expect( getData( editor.document, { rootName: 'main', withoutSelection: true } ) ).to.equal( 'foo' );
+			expect( getData( editor.model, { rootName: 'main', withoutSelection: true } ) ).to.equal( 'foo' );
 		} );
 	} );
 
@@ -97,12 +97,12 @@ describe( 'ModelTestEditor', () => {
 				.then( newEditor => {
 					editor = newEditor;
 
-					editor.document.schema.allow( { name: '$text', inside: '$root' } );
+					editor.model.schema.allow( { name: '$text', inside: '$root' } );
 				} );
 		} );
 
 		it( 'should set data of the first root', () => {
-			setData( editor.document, 'foo' );
+			setData( editor.model, 'foo' );
 
 			expect( editor.getData() ).to.equal( 'foo' );
 		} );

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

@@ -26,7 +26,7 @@ describe( 'VirtualTestEditor', () => {
 		it( 'creates model and view roots', () => {
 			const editor = new VirtualTestEditor( { foo: 1 } );
 
-			expect( editor.document.getRoot() ).to.have.property( 'name', '$root' );
+			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 );
 		} );

+ 2 - 2
packages/ckeditor5-core/tests/command.js

@@ -34,10 +34,10 @@ describe( 'Command', () => {
 			expect( command.isEnabled ).to.be.false;
 		} );
 
-		it( 'adds a listener which refreshed the command on editor.document#changesDone', () => {
+		it( 'adds a listener which refreshed the command on editor.model.document#changesDone', () => {
 			sinon.spy( command, 'refresh' );
 
-			editor.document.fire( 'changesDone' );
+			editor.model.document.fire( 'changesDone' );
 
 			expect( command.refresh.calledOnce ).to.be.true;
 		} );

+ 1 - 1
packages/ckeditor5-core/tests/editor/editor.js

@@ -193,7 +193,7 @@ describe( 'Editor', () => {
 			const editor = new Editor();
 
 			const spy1 = sinon.spy( editor.data, 'destroy' );
-			const spy2 = sinon.spy( editor.document, 'destroy' );
+			const spy2 = sinon.spy( editor.model, 'destroy' );
 			const spy3 = sinon.spy( editor.plugins, 'destroy' );
 
 			return editor.destroy()

+ 8 - 8
packages/ckeditor5-core/tests/editor/standardeditor.js

@@ -148,20 +148,20 @@ describe( 'StandardEditor', () => {
 
 					editor.data.processor = new HtmlDataProcessor();
 
-					editor.document.schema.allow( { name: '$text', inside: '$root' } );
+					editor.model.schema.allow( { name: '$text', inside: '$root' } );
 				} );
 		} );
 
 		it( 'should set data of the first root', () => {
-			editor.document.createRoot();
-			editor.document.createRoot( '$root', 'secondRoot' );
+			editor.model.document.createRoot();
+			editor.model.document.createRoot( '$root', 'secondRoot' );
 
 			editor.editing.createRoot( 'div' );
 			editor.editing.createRoot( 'div', 'secondRoot' );
 
 			editor.setData( 'foo' );
 
-			expect( getData( editor.document, { rootName: 'main', withoutSelection: true } ) ).to.equal( 'foo' );
+			expect( getData( editor.model, { rootName: 'main', withoutSelection: true } ) ).to.equal( 'foo' );
 		} );
 	} );
 
@@ -175,18 +175,18 @@ describe( 'StandardEditor', () => {
 
 					editor.data.processor = new HtmlDataProcessor();
 
-					editor.document.schema.allow( { name: '$text', inside: '$root' } );
+					editor.model.schema.allow( { name: '$text', inside: '$root' } );
 				} );
 		} );
 
 		it( 'should get data of the first root', () => {
-			editor.document.createRoot();
-			editor.document.createRoot( '$root', 'secondRoot' );
+			editor.model.document.createRoot();
+			editor.model.document.createRoot( '$root', 'secondRoot' );
 
 			editor.editing.createRoot( 'div' );
 			editor.editing.createRoot( 'div', 'secondRoot' );
 
-			setData( editor.document, 'foo' );
+			setData( editor.model, 'foo' );
 
 			expect( editor.getData() ).to.equal( 'foo' );
 		} );