瀏覽代碼

Aligned test with engine changes.

Oskar Wróbel 8 年之前
父節點
當前提交
e571cb5c91

+ 61 - 61
packages/ckeditor5-block-quote/tests/blockquotecommand.js

@@ -15,7 +15,7 @@ import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils
 import Command from '@ckeditor/ckeditor5-core/src/command';
 
 describe( 'BlockQuoteCommand', () => {
-	let editor, doc, command;
+	let editor, model, command;
 
 	beforeEach( () => {
 		return VirtualTestEditor
@@ -25,16 +25,16 @@ describe( 'BlockQuoteCommand', () => {
 			.then( newEditor => {
 				editor = newEditor;
 
-				doc = editor.document;
+				model = editor.model;
 
-				doc.schema.registerItem( 'paragraph', '$block' );
-				doc.schema.registerItem( 'heading', '$block' );
-				doc.schema.registerItem( 'widget' );
+				model.schema.registerItem( 'paragraph', '$block' );
+				model.schema.registerItem( 'heading', '$block' );
+				model.schema.registerItem( 'widget' );
 
-				doc.schema.allow( { name: 'widget', inside: '$root' } );
-				doc.schema.allow( { name: '$text', inside: 'widget' } );
+				model.schema.allow( { name: 'widget', inside: '$root' } );
+				model.schema.allow( { name: '$text', inside: 'widget' } );
 
-				doc.schema.limits.add( 'widget' );
+				model.schema.limits.add( 'widget' );
 
 				buildModelConverter().for( editor.editing.modelToView )
 					.fromElement( 'paragraph' )
@@ -63,33 +63,33 @@ describe( 'BlockQuoteCommand', () => {
 
 	describe( 'value', () => {
 		it( 'is false when selection is not in a block quote', () => {
-			setModelData( doc, '<paragraph>x[]x</paragraph>' );
+			setModelData( model, '<paragraph>x[]x</paragraph>' );
 
 			expect( command ).to.have.property( 'value', false );
 		} );
 
 		it( 'is false when start of the selection is not in a block quote', () => {
-			setModelData( doc, '<paragraph>x[x</paragraph><blockQuote><paragraph>y]y</paragraph></blockQuote>' );
+			setModelData( model, '<paragraph>x[x</paragraph><blockQuote><paragraph>y]y</paragraph></blockQuote>' );
 
 			expect( command ).to.have.property( 'value', false );
 		} );
 
 		it( 'is false when selection starts in a blockless space', () => {
-			doc.schema.allow( { name: '$text', inside: '$root' } );
+			model.schema.allow( { name: '$text', inside: '$root' } );
 
-			setModelData( doc, 'x[]x' );
+			setModelData( model, 'x[]x' );
 
 			expect( command ).to.have.property( 'value', false );
 		} );
 
 		it( 'is true when selection is in a block quote', () => {
-			setModelData( doc, '<blockQuote><paragraph>x[]x</paragraph></blockQuote>' );
+			setModelData( model, '<blockQuote><paragraph>x[]x</paragraph></blockQuote>' );
 
 			expect( command ).to.have.property( 'value', true );
 		} );
 
 		it( 'is true when selection starts in a block quote', () => {
-			setModelData( doc, '<blockQuote><paragraph>x[x</paragraph></blockQuote><paragraph>y]y</paragraph>' );
+			setModelData( model, '<blockQuote><paragraph>x[x</paragraph></blockQuote><paragraph>y]y</paragraph>' );
 
 			expect( command ).to.have.property( 'value', true );
 		} );
@@ -97,25 +97,25 @@ describe( 'BlockQuoteCommand', () => {
 
 	describe( 'isEnabled', () => {
 		it( 'is true when selection is in a block which can be wrapped with blockQuote', () => {
-			setModelData( doc, '<paragraph>x[]x</paragraph>' );
+			setModelData( model, '<paragraph>x[]x</paragraph>' );
 
 			expect( command ).to.have.property( 'isEnabled', true );
 		} );
 
 		it( 'is true when selection is in a block which is already in blockQuote', () => {
-			setModelData( doc, '<blockQuote><paragraph>x[]x</paragraph></blockQuote>' );
+			setModelData( model, '<blockQuote><paragraph>x[]x</paragraph></blockQuote>' );
 
 			expect( command ).to.have.property( 'isEnabled', true );
 		} );
 
 		it( 'is true when selection starts in a block which can be wrapped with blockQuote', () => {
-			setModelData( doc, '<paragraph>x[x</paragraph><widget>y]y</widget>' );
+			setModelData( model, '<paragraph>x[x</paragraph><widget>y]y</widget>' );
 
 			expect( command ).to.have.property( 'isEnabled', true );
 		} );
 
 		it( 'is false when selection is in an element which cannot be wrapped with blockQuote (because it cannot be its child)', () => {
-			setModelData( doc, '<widget>x[]x</widget>' );
+			setModelData( model, '<widget>x[]x</widget>' );
 
 			expect( command ).to.have.property( 'isEnabled', false );
 		} );
@@ -124,9 +124,9 @@ describe( 'BlockQuoteCommand', () => {
 			'is false when selection is in an element which cannot be wrapped with blockQuote' +
 			'(because mQ is not allowed in its parent)',
 			() => {
-				doc.schema.disallow( { name: 'blockQuote', inside: '$root' } );
+				model.schema.disallow( { name: 'blockQuote', inside: '$root' } );
 
-				setModelData( doc, '<paragraph>x[]x</paragraph>' );
+				setModelData( model, '<paragraph>x[]x</paragraph>' );
 
 				expect( command ).to.have.property( 'isEnabled', false );
 			}
@@ -134,7 +134,7 @@ describe( 'BlockQuoteCommand', () => {
 
 		// https://github.com/ckeditor/ckeditor5-engine/issues/826
 		// it( 'is false when selection starts in an element which cannot be wrapped with blockQuote', () => {
-		// 	setModelData( doc, '<widget>x[x</widget><paragraph>y]y</paragraph>' );
+		// 	setModelData( model, '<widget>x[x</widget><paragraph>y]y</paragraph>' );
 
 		// 	expect( command ).to.have.property( 'isEnabled', false );
 		// } );
@@ -144,7 +144,7 @@ describe( 'BlockQuoteCommand', () => {
 		describe( 'applying quote', () => {
 			it( 'should wrap a single block', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>abc</paragraph>' +
 					'<paragraph>x[]x</paragraph>' +
 					'<paragraph>def</paragraph>'
@@ -152,7 +152,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<paragraph>abc</paragraph>' +
 					'<blockQuote><paragraph>x[]x</paragraph></blockQuote>' +
 					'<paragraph>def</paragraph>'
@@ -165,7 +165,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should wrap multiple blocks', () => {
 				setModelData(
-					doc,
+					model,
 					'<heading>a[bc</heading>' +
 					'<paragraph>xx</paragraph>' +
 					'<paragraph>de]f</paragraph>'
@@ -173,7 +173,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote>' +
 						'<heading>a[bc</heading>' +
 						'<paragraph>xx</paragraph>' +
@@ -188,7 +188,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should merge with an existing quote', () => {
 				setModelData(
-					doc,
+					model,
 					'<heading>a[bc</heading>' +
 					'<blockQuote><paragraph>x]x</paragraph><paragraph>yy</paragraph></blockQuote>' +
 					'<paragraph>def</paragraph>'
@@ -196,7 +196,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote>' +
 						'<heading>a[bc</heading>' +
 						'<paragraph>x]x</paragraph>' +
@@ -212,14 +212,14 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should not merge with a quote preceding the current block', () => {
 				setModelData(
-					doc,
+					model,
 					'<blockQuote><paragraph>abc</paragraph></blockQuote>' +
 					'<paragraph>x[]x</paragraph>'
 				);
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote><paragraph>abc</paragraph></blockQuote>' +
 					'<blockQuote><paragraph>x[]x</paragraph></blockQuote>'
 				);
@@ -232,14 +232,14 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should not merge with a quote following the current block', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>x[]x</paragraph>' +
 					'<blockQuote><paragraph>abc</paragraph></blockQuote>'
 				);
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote><paragraph>x[]x</paragraph></blockQuote>' +
 					'<blockQuote><paragraph>abc</paragraph></blockQuote>'
 				);
@@ -252,7 +252,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should merge with an existing quote (more blocks)', () => {
 				setModelData(
-					doc,
+					model,
 					'<heading>a[bc</heading>' +
 					'<paragraph>def</paragraph>' +
 					'<blockQuote><paragraph>x]x</paragraph></blockQuote>' +
@@ -261,7 +261,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote>' +
 						'<heading>a[bc</heading>' +
 						'<paragraph>def</paragraph>' +
@@ -277,7 +277,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should not wrap non-block content', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>a[bc</paragraph>' +
 					'<widget>xx</widget>' +
 					'<paragraph>de]f</paragraph>'
@@ -285,7 +285,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote>' +
 						'<paragraph>a[bc</paragraph>' +
 					'</blockQuote>' +
@@ -302,7 +302,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should correctly wrap and merge groups of blocks', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>a[bc</paragraph>' +
 					'<widget>xx</widget>' +
 					'<paragraph>def</paragraph>' +
@@ -313,7 +313,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote><paragraph>a[bc</paragraph></blockQuote>' +
 					'<widget>xx</widget>' +
 					'<blockQuote><paragraph>def</paragraph><paragraph>ghi</paragraph></blockQuote>' +
@@ -332,7 +332,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should correctly merge a couple of subsequent quotes', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>x</paragraph>' +
 					'<paragraph>a[bc</paragraph>' +
 					'<blockQuote><paragraph>def</paragraph></blockQuote>' +
@@ -344,7 +344,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<paragraph>x</paragraph>' +
 					'<blockQuote>' +
 						'<paragraph>a[bc</paragraph>' +
@@ -371,14 +371,14 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should not wrap a block which can not be in a quote', () => {
 				// blockQuote is allowed in root, but fooBlock can not be inside blockQuote.
-				doc.schema.registerItem( 'fooBlock', '$block' );
-				doc.schema.disallow( { name: 'fooBlock', inside: 'blockQuote' } );
+				model.schema.registerItem( 'fooBlock', '$block' );
+				model.schema.disallow( { name: 'fooBlock', inside: 'blockQuote' } );
 				buildModelConverter().for( editor.editing.modelToView )
 					.fromElement( 'fooBlock' )
 					.toElement( 'fooblock' );
 
 				setModelData(
-					doc,
+					model,
 					'<paragraph>a[bc</paragraph>' +
 					'<fooBlock>xx</fooBlock>' +
 					'<paragraph>de]f</paragraph>'
@@ -386,7 +386,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote>' +
 						'<paragraph>a[bc</paragraph>' +
 					'</blockQuote>' +
@@ -399,11 +399,11 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should not wrap a block which parent does not allow quote inside itself', () => {
 				// blockQuote is not be allowed in fooWrapper, but fooBlock can be inside blockQuote.
-				doc.schema.registerItem( 'fooWrapper' );
-				doc.schema.registerItem( 'fooBlock', '$block' );
+				model.schema.registerItem( 'fooWrapper' );
+				model.schema.registerItem( 'fooBlock', '$block' );
 
-				doc.schema.allow( { name: 'fooWrapper', inside: '$root' } );
-				doc.schema.allow( { name: 'fooBlock', inside: 'fooWrapper' } );
+				model.schema.allow( { name: 'fooWrapper', inside: '$root' } );
+				model.schema.allow( { name: 'fooBlock', inside: 'fooWrapper' } );
 
 				buildModelConverter().for( editor.editing.modelToView )
 					.fromElement( 'fooWrapper' )
@@ -413,7 +413,7 @@ describe( 'BlockQuoteCommand', () => {
 					.toElement( 'fooblock' );
 
 				setModelData(
-					doc,
+					model,
 					'<paragraph>a[bc</paragraph>' +
 					'<fooWrapper><fooBlock>xx</fooBlock></fooWrapper>' +
 					'<paragraph>de]f</paragraph>'
@@ -421,7 +421,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote>' +
 						'<paragraph>a[bc</paragraph>' +
 					'</blockQuote>' +
@@ -436,7 +436,7 @@ describe( 'BlockQuoteCommand', () => {
 		describe( 'removing quote', () => {
 			it( 'should unwrap a single block', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>abc</paragraph>' +
 					'<blockQuote><paragraph>x[]x</paragraph></blockQuote>' +
 					'<paragraph>def</paragraph>'
@@ -444,7 +444,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<paragraph>abc</paragraph>' +
 					'<paragraph>x[]x</paragraph>' +
 					'<paragraph>def</paragraph>'
@@ -457,7 +457,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should unwrap multiple blocks', () => {
 				setModelData(
-					doc,
+					model,
 					'<blockQuote>' +
 						'<paragraph>a[bc</paragraph>' +
 						'<paragraph>xx</paragraph>' +
@@ -467,7 +467,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<paragraph>a[bc</paragraph>' +
 					'<paragraph>xx</paragraph>' +
 					'<paragraph>de]f</paragraph>'
@@ -480,7 +480,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should unwrap only the selected blocks - at the beginning', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>xx</paragraph>' +
 					'<blockQuote>' +
 						'<paragraph>a[b]c</paragraph>' +
@@ -491,7 +491,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<paragraph>xx</paragraph>' +
 					'<paragraph>a[b]c</paragraph>' +
 					'<blockQuote>' +
@@ -507,7 +507,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should unwrap only the selected blocks - at the end', () => {
 				setModelData(
-					doc,
+					model,
 					'<blockQuote>' +
 						'<paragraph>abc</paragraph>' +
 						'<paragraph>x[x</paragraph>' +
@@ -517,7 +517,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<blockQuote>' +
 						'<paragraph>abc</paragraph>' +
 					'</blockQuote>' +
@@ -532,7 +532,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should unwrap only the selected blocks - in the middle', () => {
 				setModelData(
-					doc,
+					model,
 					'<paragraph>xx</paragraph>' +
 					'<blockQuote>' +
 						'<paragraph>abc</paragraph>' +
@@ -544,7 +544,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<paragraph>xx</paragraph>' +
 					'<blockQuote><paragraph>abc</paragraph></blockQuote>' +
 					'<paragraph>c[]de</paragraph>' +
@@ -563,7 +563,7 @@ describe( 'BlockQuoteCommand', () => {
 
 			it( 'should remove multiple quotes', () => {
 				setModelData(
-					doc,
+					model,
 					'<blockQuote><paragraph>a[bc</paragraph></blockQuote>' +
 					'<paragraph>xx</paragraph>' +
 					'<blockQuote><paragraph>def</paragraph><paragraph>ghi</paragraph></blockQuote>' +
@@ -573,7 +573,7 @@ describe( 'BlockQuoteCommand', () => {
 
 				editor.execute( 'blockQuote' );
 
-				expect( getModelData( doc ) ).to.equal(
+				expect( getModelData( model ) ).to.equal(
 					'<paragraph>a[bc</paragraph>' +
 					'<paragraph>xx</paragraph>' +
 					'<paragraph>def</paragraph><paragraph>ghi</paragraph>' +

+ 8 - 9
packages/ckeditor5-block-quote/tests/blockquoteengine.js

@@ -13,7 +13,7 @@ import { getData as getModelData, setData as setModelData } from '@ckeditor/cked
 import BlockQuoteCommand from '../src/blockquotecommand';
 
 describe( 'BlockQuoteEngine', () => {
-	let editor, doc;
+	let editor, model;
 
 	beforeEach( () => {
 		return VirtualTestEditor
@@ -22,13 +22,12 @@ describe( 'BlockQuoteEngine', () => {
 			} )
 			.then( newEditor => {
 				editor = newEditor;
-
-				doc = editor.document;
+				model = editor.model;
 			} );
 	} );
 
 	afterEach( () => {
-		editor.destroy();
+		return editor.destroy();
 	} );
 
 	it( 'adds a blockQuote command', () => {
@@ -36,12 +35,12 @@ describe( 'BlockQuoteEngine', () => {
 	} );
 
 	it( 'allows for blockQuote in the $root', () => {
-		expect( doc.schema.check( { name: 'blockQuote', inside: '$root' } ) ).to.be.true;
+		expect( model.schema.check( { name: 'blockQuote', inside: '$root' } ) ).to.be.true;
 	} );
 
 	it( 'allows for $block in blockQuote', () => {
-		expect( doc.schema.check( { name: '$block', inside: 'blockQuote' } ) ).to.be.true;
-		expect( doc.schema.check( { name: 'paragraph', inside: 'blockQuote' } ) ).to.be.true;
+		expect( model.schema.check( { name: '$block', inside: 'blockQuote' } ) ).to.be.true;
+		expect( model.schema.check( { name: 'paragraph', inside: 'blockQuote' } ) ).to.be.true;
 	} );
 
 	it( 'adds converters to the data pipeline', () => {
@@ -49,12 +48,12 @@ describe( 'BlockQuoteEngine', () => {
 
 		editor.setData( data );
 
-		expect( getModelData( doc ) ).to.equal( '<blockQuote><paragraph>[]x</paragraph></blockQuote>' );
+		expect( getModelData( model ) ).to.equal( '<blockQuote><paragraph>[]x</paragraph></blockQuote>' );
 		expect( editor.getData() ).to.equal( data );
 	} );
 
 	it( 'adds a converter to the view pipeline', () => {
-		setModelData( doc, '<blockQuote><paragraph>x</paragraph></blockQuote>' );
+		setModelData( model, '<blockQuote><paragraph>x</paragraph></blockQuote>' );
 
 		expect( editor.getData() ).to.equal( '<blockquote><p>x</p></blockquote>' );
 	} );

+ 32 - 32
packages/ckeditor5-block-quote/tests/integration.js

@@ -17,7 +17,7 @@ import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictest
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
 describe( 'BlockQuote', () => {
-	let editor, doc, element;
+	let editor, model, element;
 
 	beforeEach( () => {
 		element = document.createElement( 'div' );
@@ -29,7 +29,7 @@ describe( 'BlockQuote', () => {
 			} )
 			.then( newEditor => {
 				editor = newEditor;
-				doc = editor.document;
+				model = editor.model;
 			} );
 	} );
 
@@ -50,7 +50,7 @@ describe( 'BlockQuote', () => {
 			const data = fakeEventData();
 			const execSpy = sinon.spy( editor, 'execute' );
 
-			setModelData( doc, '<paragraph>x</paragraph><paragraph>[]</paragraph><paragraph>x</paragraph>' );
+			setModelData( model, '<paragraph>x</paragraph><paragraph>[]</paragraph><paragraph>x</paragraph>' );
 
 			editor.editing.view.fire( 'enter', data );
 
@@ -64,7 +64,7 @@ describe( 'BlockQuote', () => {
 			const data = fakeEventData();
 			const execSpy = sinon.spy( editor, 'execute' );
 
-			setModelData( doc, '<blockQuote><paragraph>xx[]</paragraph></blockQuote>' );
+			setModelData( model, '<blockQuote><paragraph>xx[]</paragraph></blockQuote>' );
 
 			editor.editing.view.fire( 'enter', data );
 
@@ -78,7 +78,7 @@ describe( 'BlockQuote', () => {
 			const data = fakeEventData();
 			const execSpy = sinon.spy( editor, 'execute' );
 
-			setModelData( doc, '<blockQuote><paragraph>[]xx</paragraph></blockQuote>' );
+			setModelData( model, '<blockQuote><paragraph>[]xx</paragraph></blockQuote>' );
 
 			editor.editing.view.fire( 'enter', data );
 
@@ -92,7 +92,7 @@ describe( 'BlockQuote', () => {
 			const data = fakeEventData();
 			const execSpy = sinon.spy( editor, 'execute' );
 
-			setModelData( doc, '<blockQuote><paragraph>[</paragraph><paragraph>]</paragraph></blockQuote>' );
+			setModelData( model, '<blockQuote><paragraph>[</paragraph><paragraph>]</paragraph></blockQuote>' );
 
 			editor.editing.view.fire( 'enter', data );
 
@@ -105,7 +105,7 @@ describe( 'BlockQuote', () => {
 		it( 'does not interfere with a similar handler in the list feature', () => {
 			const data = fakeEventData();
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote>' +
 					'<listItem indent="0" type="bulleted">a</listItem>' +
@@ -118,7 +118,7 @@ describe( 'BlockQuote', () => {
 
 			expect( data.preventDefault.called ).to.be.true;
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<paragraph>x</paragraph>' +
 				'<blockQuote>' +
 					'<listItem indent="0" type="bulleted">a</listItem>' +
@@ -132,7 +132,7 @@ describe( 'BlockQuote', () => {
 			const data = fakeEventData();
 			const execSpy = sinon.spy( editor, 'execute' );
 
-			setModelData( doc, '<paragraph>x</paragraph><blockQuote><paragraph>[]</paragraph></blockQuote><paragraph>x</paragraph>' );
+			setModelData( model, '<paragraph>x</paragraph><blockQuote><paragraph>[]</paragraph></blockQuote><paragraph>x</paragraph>' );
 
 			editor.editing.view.fire( 'enter', data );
 
@@ -140,14 +140,14 @@ describe( 'BlockQuote', () => {
 			expect( execSpy.calledOnce ).to.be.true;
 			expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'blockQuote' );
 
-			expect( getModelData( doc ) ).to.equal( '<paragraph>x</paragraph><paragraph>[]</paragraph><paragraph>x</paragraph>' );
+			expect( getModelData( model ) ).to.equal( '<paragraph>x</paragraph><paragraph>[]</paragraph><paragraph>x</paragraph>' );
 		} );
 
 		it( 'escapes block quote if selection is in an empty block in the middle of a block quote', () => {
 			const data = fakeEventData();
 			const execSpy = sinon.spy( editor, 'execute' );
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph><paragraph>[]</paragraph><paragraph>b</paragraph></blockQuote>' +
 				'<paragraph>x</paragraph>'
@@ -159,7 +159,7 @@ describe( 'BlockQuote', () => {
 			expect( execSpy.calledOnce ).to.be.true;
 			expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'blockQuote' );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph></blockQuote>' +
 				'<paragraph>[]</paragraph>' +
@@ -172,7 +172,7 @@ describe( 'BlockQuote', () => {
 			const data = fakeEventData();
 			const execSpy = sinon.spy( editor, 'execute' );
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph><paragraph>[]</paragraph></blockQuote>' +
 				'<paragraph>x</paragraph>'
@@ -184,7 +184,7 @@ describe( 'BlockQuote', () => {
 			expect( execSpy.calledOnce ).to.be.true;
 			expect( execSpy.args[ 0 ][ 0 ] ).to.equal( 'blockQuote' );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph></blockQuote>' +
 				'<paragraph>[]</paragraph>' +
@@ -197,7 +197,7 @@ describe( 'BlockQuote', () => {
 			const execSpy = sinon.spy( editor, 'execute' );
 			const scrollSpy = sinon.stub( editor.editing.view, 'scrollToTheSelection' );
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph><paragraph>[]</paragraph></blockQuote>' +
 				'<paragraph>x</paragraph>'
@@ -222,7 +222,7 @@ describe( 'BlockQuote', () => {
 		it( 'merges paragraph into paragraph in the quote', () => {
 			const data = fakeEventData();
 
-			setModelData( doc,
+			setModelData( model,
 				'<blockQuote><paragraph>a</paragraph><paragraph>b</paragraph></blockQuote>' +
 				'<paragraph>[]c</paragraph>' +
 				'<paragraph>d</paragraph>'
@@ -230,7 +230,7 @@ describe( 'BlockQuote', () => {
 
 			editor.editing.view.fire( 'delete', data );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<blockQuote><paragraph>a</paragraph><paragraph>b[]c</paragraph></blockQuote>' +
 				'<paragraph>d</paragraph>'
 			);
@@ -239,7 +239,7 @@ describe( 'BlockQuote', () => {
 		it( 'merges paragraph from a quote into a paragraph before quote', () => {
 			const data = fakeEventData();
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>[]a</paragraph><paragraph>b</paragraph></blockQuote>' +
 				'<paragraph>y</paragraph>'
@@ -247,7 +247,7 @@ describe( 'BlockQuote', () => {
 
 			editor.editing.view.fire( 'delete', data );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<paragraph>x[]a</paragraph>' +
 				'<blockQuote><paragraph>b</paragraph></blockQuote>' +
 				'<paragraph>y</paragraph>'
@@ -257,7 +257,7 @@ describe( 'BlockQuote', () => {
 		it( 'merges two quotes', () => {
 			const data = fakeEventData();
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph><paragraph>b</paragraph></blockQuote>' +
 				'<blockQuote><paragraph>[]c</paragraph><paragraph>d</paragraph></blockQuote>' +
@@ -266,7 +266,7 @@ describe( 'BlockQuote', () => {
 
 			editor.editing.view.fire( 'delete', data );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph><paragraph>b[]c</paragraph><paragraph>d</paragraph></blockQuote>' +
 				'<paragraph>y</paragraph>'
@@ -276,7 +276,7 @@ describe( 'BlockQuote', () => {
 		it( 'removes empty quote when merging into another quote', () => {
 			const data = fakeEventData();
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a</paragraph></blockQuote>' +
 				'<blockQuote><paragraph>[]</paragraph></blockQuote>' +
@@ -285,7 +285,7 @@ describe( 'BlockQuote', () => {
 
 			editor.editing.view.fire( 'delete', data );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>a[]</paragraph></blockQuote>' +
 				'<paragraph>y</paragraph>'
@@ -295,7 +295,7 @@ describe( 'BlockQuote', () => {
 		it( 'removes empty quote when merging into a paragraph', () => {
 			const data = fakeEventData();
 
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>x</paragraph>' +
 				'<blockQuote><paragraph>[]</paragraph></blockQuote>' +
 				'<paragraph>y</paragraph>'
@@ -303,7 +303,7 @@ describe( 'BlockQuote', () => {
 
 			editor.editing.view.fire( 'delete', data );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<paragraph>x[]</paragraph>' +
 				'<paragraph>y</paragraph>'
 			);
@@ -321,7 +321,7 @@ describe( 'BlockQuote', () => {
 					plugins: [ BlockQuote, Paragraph, Image ]
 				} )
 				.then( editor => {
-					setModelData( editor.document,
+					setModelData( editor.model,
 						'<paragraph>fo[o</paragraph>' +
 						'<image src="foo.png"></image>' +
 						'<paragraph>b]ar</paragraph>'
@@ -329,19 +329,19 @@ describe( 'BlockQuote', () => {
 
 					editor.execute( 'blockQuote' );
 
-					expect( getModelData( editor.document ) ).to.equal(
+					expect( getModelData( editor.model ) ).to.equal(
 						'<blockQuote><paragraph>fo[o</paragraph></blockQuote>' +
 						'<image src="foo.png"></image>' +
 						'<blockQuote><paragraph>b]ar</paragraph></blockQuote>'
 					);
 
 					element.remove();
-					editor.destroy();
+					return editor.destroy();
 				} );
 		} );
 
 		it( 'does not quote an image with caption', () => {
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>fo[o</paragraph>' +
 				'<image src="foo.png">' +
 					'<caption>xxx</caption>' +
@@ -351,7 +351,7 @@ describe( 'BlockQuote', () => {
 
 			editor.execute( 'blockQuote' );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<blockQuote><paragraph>fo[o</paragraph></blockQuote>' +
 				'<image src="foo.png">' +
 					'<caption>xxx</caption>' +
@@ -361,7 +361,7 @@ describe( 'BlockQuote', () => {
 		} );
 
 		it( 'does not add an image to existing quote', () => {
-			setModelData( doc,
+			setModelData( model,
 				'<paragraph>fo[o</paragraph>' +
 				'<image src="foo.png">' +
 					'<caption>xxx</caption>' +
@@ -371,7 +371,7 @@ describe( 'BlockQuote', () => {
 
 			editor.execute( 'blockQuote' );
 
-			expect( getModelData( doc ) ).to.equal(
+			expect( getModelData( model ) ).to.equal(
 				'<blockQuote><paragraph>fo[o</paragraph></blockQuote>' +
 				'<image src="foo.png">' +
 					'<caption>xxx</caption>' +