浏览代码

Converted more schem.allow() calls.

Piotrek Koszuliński 8 年之前
父节点
当前提交
c37b06c4b8

+ 6 - 5
packages/ckeditor5-engine/src/model/model.js

@@ -74,13 +74,14 @@ export default class Model {
 		this.schema.register( '$block', { allowIn: '$root' } );
 		this.schema.register( '$text', { allowIn: '$block' } );
 
-		// TMP!
+		// TODO review
 		// Create an "all allowed" context in the schema for processing the pasted content.
 		// Read: https://github.com/ckeditor/ckeditor5-engine/issues/638#issuecomment-255086588
-		//
-		// TODO
-		// this.schema.register( '$clipboardHolder', '$root' );
-		// this.schema.allow( { name: '$inline', inside: '$clipboardHolder' } );
+
+		this.schema.register( '$clipboardHolder', {
+			allowContentOf: '$root'
+		} );
+		this.schema.extend( '$text', { allowIn: '$clipboardHolder' } );
 	}
 
 	/**

+ 4 - 0
packages/ckeditor5-engine/src/model/schema.js

@@ -163,6 +163,10 @@ export default class Schema {
 		return element;
 	}
 
+	removeDisallowedAttributes() {
+		// TODO
+	}
+
 	_clearCache() {
 		this._compiledRules = null;
 	}

+ 1 - 3
packages/ckeditor5-engine/src/model/selection.js

@@ -785,9 +785,7 @@ function isUnvisitedBlockContainer( element, visited ) {
 
 	visited.add( element );
 
-	// TODO https://github.com/ckeditor/ckeditor5-engine/issues/532#issuecomment-278900072.
-	// This should not be a `$block` check.
-	return element.document.model.schema.itemExtends( element.name, '$block' ) && element.parent;
+	return element.document.model.schema.isBlock( element.name ) && element.parent;
 }
 
 // Finds the lowest element in position's ancestors which is a block.

+ 1 - 1
packages/ckeditor5-engine/src/model/utils/deletecontent.js

@@ -158,7 +158,7 @@ function mergeBranches( writer, startPos, endPos ) {
 
 function shouldAutoparagraph( schema, position ) {
 	const isTextAllowed = schema.checkChild( position, '$text' );
-	const isParagraphAllowed = schema.check( position, 'paragraph' );
+	const isParagraphAllowed = schema.checkChild( position, 'paragraph' );
 
 	return !isTextAllowed && isParagraphAllowed;
 }

+ 3 - 1
packages/ckeditor5-engine/tests/controller/datacontroller.js

@@ -76,7 +76,9 @@ describe( 'DataController', () => {
 
 		it( 'should set paragraphs with bold', () => {
 			schema.register( 'paragraph', { inheritAllFrom: '$block' } );
-			schema.allow( { name: '$text', attributes: [ 'bold' ], inside: '$block' } );
+			schema.extend( '$text', {
+				allowAttributes: [ 'bold' ]
+			} );
 
 			buildViewConverter().for( data.viewToModel ).fromElement( 'p' ).toElement( 'paragraph' );
 			buildViewConverter().for( data.viewToModel ).fromElement( 'b' ).toAttribute( 'bold', true );

+ 42 - 28
packages/ckeditor5-engine/tests/conversion/buildviewconverter.js

@@ -6,7 +6,6 @@
 import buildViewConverter from '../../src/conversion/buildviewconverter';
 
 import Model from '../../src/model/model';
-import ModelSchema from '../../src/model/schema';
 import ModelDocumentFragment from '../../src/model/documentfragment';
 import ModelElement from '../../src/model/element';
 import ModelTextProxy from '../../src/model/textproxy';
@@ -60,36 +59,49 @@ function modelToString( item ) {
 	return result;
 }
 
-const textAttributes = [ undefined, 'linkHref', 'linkTitle', 'bold', 'italic', 'style' ];
-const pAttributes = [ undefined, 'class', 'important', 'theme', 'decorated', 'size' ];
+const textAttributes = [ 'linkHref', 'linkTitle', 'bold', 'italic', 'style' ];
+const pAttributes = [ 'class', 'important', 'theme', 'decorated', 'size' ];
 
 describe( 'View converter builder', () => {
-	let dispatcher, schema, additionalData;
-
-	const model = new Model();
+	let dispatcher, model, schema, additionalData;
 
 	beforeEach( () => {
+		model = new Model();
+
 		// `additionalData` parameter for `.convert` calls.
 		additionalData = { context: [ '$root' ] };
 
-		schema = new ModelSchema();
-
-		schema.register( 'paragraph', { inheritAllFrom: '$block' } );
-		schema.register( 'div', { inheritAllFrom: '$block' } );
-		schema.register( 'customP', { inheritAllFrom: 'paragraph' } );
-		schema.register( 'image', { inheritAllFrom: '$inline' } );
-		schema.register( 'span', { inheritAllFrom: '$inline' } );
-		schema.register( 'MEGATRON', { inheritAllFrom: '$inline' } ); // Yes, folks, we are building MEGATRON.
-		schema.register( 'abcd', { inheritAllFrom: '$inline' } );
-		schema.allow( { name: '$inline', attributes: textAttributes, inside: '$root' } );
-		schema.allow( { name: 'image', attributes: [ 'src' ], inside: '$root' } );
-		schema.allow( { name: 'image', attributes: [ 'src' ], inside: '$block' } );
-		schema.extend( '$text', { allowIn: '$inline' } );
-		schema.allow( { name: '$text', attributes: textAttributes, inside: '$block' } );
-		schema.allow( { name: '$text', attributes: textAttributes, inside: '$root' } );
-		schema.allow( { name: 'paragraph', attributes: pAttributes, inside: '$root' } );
-		schema.allow( { name: 'span', attributes: [ 'transformer' ], inside: '$root' } );
-		schema.allow( { name: 'div', attributes: [ 'class' ], inside: '$root' } );
+		schema = model.schema;
+
+		schema.register( 'paragraph', {
+			inheritAllFrom: '$block',
+			allowAttributes: pAttributes
+		} );
+		schema.register( 'div', {
+			inheritAllFrom: '$block',
+			allowAttributes: 'class'
+		} );
+		schema.register( 'customP', {
+			inheritAllFrom: 'paragraph'
+		} );
+		schema.register( 'image', {
+			inheritAllFrom: '$text',
+			allowAttributes: 'src'
+		} );
+		schema.register( 'span', {
+			inheritAllFrom: '$text',
+			allowAttributes: 'transformer'
+		} );
+		// Yes, folks, we are building MEGATRON.
+		schema.register( 'MEGATRON', {
+			inheritAllFrom: '$text'
+		} );
+		schema.register( 'abcd', {
+			inheritAllFrom: '$text'
+		} );
+		schema.extend( '$text', {
+			allowAttributes: textAttributes
+		} );
 
 		dispatcher = new ViewConversionDispatcher( model, { schema } );
 		dispatcher.on( 'text', convertText() );
@@ -152,7 +164,7 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should convert from view attribute and key to model attribute', () => {
-		schema.allow( { name: 'paragraph', attributes: [ 'type' ], inside: '$root' } );
+		schema.extend( 'paragraph', { allowAttributes: 'type' } );
 
 		dispatcher.on( 'documentFragment', convertToModelFragment() );
 
@@ -481,7 +493,8 @@ describe( 'View converter builder', () => {
 		buildViewConverter().for( dispatcher ).fromElement( 'div' ).toElement( 'div' );
 		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 
-		schema.disallow( { name: 'div', inside: '$root' } );
+		// TODO this requires a callback
+		// schema.xdisallow( { name: 'div', inside: '$root' } );
 
 		dispatcher.on( 'element', convertToModelFragment(), { priority: 'lowest' } );
 
@@ -500,7 +513,8 @@ describe( 'View converter builder', () => {
 		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 		buildViewConverter().for( dispatcher ).fromElement( 'strong' ).toAttribute( 'bold', true );
 
-		schema.disallow( { name: '$text', attributes: 'bold', inside: 'paragraph' } );
+		// TODO this requires a callback
+		// schema.xdisallow( { name: '$text', attributes: 'bold', inside: 'paragraph' } );
 
 		dispatcher.on( 'element', convertToModelFragment(), { priority: 'lowest' } );
 
@@ -535,7 +549,7 @@ describe( 'View converter builder', () => {
 	} );
 
 	it( 'should stop to attribute conversion if creating function returned null', () => {
-		schema.allow( { name: 'paragraph', attributes: [ 'type' ], inside: '$root' } );
+		schema.extend( 'paragraph', { allowAttributes: 'type' } );
 
 		buildViewConverter().for( dispatcher ).fromElement( 'p' ).toElement( 'paragraph' );
 

+ 8 - 5
packages/ckeditor5-engine/tests/conversion/definition-based-converters.js

@@ -215,9 +215,10 @@ describe( 'definition-based-converters', () => {
 				setupViewToModelTests();
 
 				schema.register( 'div', { inheritAllFrom: '$block' } );
-
-				schema.allow( { name: '$inline', attributes: [ 'foo' ], inside: '$root' } );
-				schema.extend( '$text', { allowIn: '$root' } );
+				schema.extend( '$text', {
+					allowIn: '$root',
+					allowAttributes: 'foo'
+				} );
 
 				dispatcher.on( 'text', convertText() );
 			} );
@@ -381,8 +382,10 @@ describe( 'definition-based-converters', () => {
 				schema.register( 'bar', { inheritAllFrom: '$block' } );
 				schema.register( 'baz', { inheritAllFrom: '$block' } );
 
-				schema.allow( { name: '$inline', attribute: [ 'foo' ], inside: '$root' } );
-				schema.extend( '$text', { allowIn: '$inline' } );
+				schema.extend( '$text', {
+					allowIn: '$root',
+					allowAttributes: 'foo'
+				} );
 
 				dispatcher.on( 'text', convertText() );
 			} );

+ 2 - 1
packages/ckeditor5-engine/tests/conversion/view-to-model-converters.js

@@ -62,7 +62,8 @@ describe( 'view-to-model-converters', () => {
 		} );
 
 		it( 'should not convert text if it is wrong with schema', () => {
-			schema.disallow( { name: '$text', inside: '$root' } );
+			// TODO this requires a callback
+			// schema.xdisallow( { name: '$text', inside: '$root' } );
 
 			const viewText = new ViewText( 'foobar' );
 			dispatcher.on( 'text', convertText() );

+ 18 - 12
packages/ckeditor5-engine/tests/dev-utils/model.js

@@ -23,22 +23,28 @@ describe( 'model test utils', () => {
 		sandbox = sinon.sandbox.create();
 		selection.removeAllRanges();
 
-		model.schema.register( 'a', { inheritAllFrom: '$inline' } );
-		model.schema.extend( 'a', { allowIn: '$root' } );
-		model.schema.allow( { name: 'a', inside: '$root', attributes: [ 'bar', 'car', 'foo' ] } );
+		model.schema.register( 'a', {
+			allowWhere: '$text',
+			allowIn: '$root',
+			allowAttributes: [ 'bar', 'car', 'foo' ]
+		} );
 
-		model.schema.register( 'b', { inheritAllFrom: '$inline' } );
-		model.schema.extend( 'b', { allowIn: '$root' } );
-		model.schema.allow( { name: 'b', inside: '$root', attributes: [ 'barFoo', 'fooBar', 'x' ] } );
+		model.schema.register( 'b', {
+			allowWhere: '$text',
+			allowIn: '$root',
+			allowAttributes: [ 'barFoo', 'fooBar', 'x' ]
+		} );
 
-		model.schema.register( 'c', { inheritAllFrom: '$inline' } );
-		model.schema.extend( 'c', { allowIn: '$root' } );
+		model.schema.register( 'c', {
+			allowWhere: '$text',
+			allowIn: [ '$root', 'b' ]
+		} );
 
 		model.schema.register( 'paragraph', { inheritAllFrom: '$block' } );
-		model.schema.extend( '$text', { allowIn: '$root' } );
-		model.schema.extend( '$text', { allowIn: 'a' } );
-		model.schema.extend( '$text', { allowIn: 'b' } );
-		model.schema.extend( 'c', { allowIn: 'b' } );
+
+		model.schema.extend( '$text', {
+			allowIn: [ '$root', 'a', 'b' ]
+		} );
 	} );
 
 	afterEach( () => {

+ 3 - 3
packages/ckeditor5-engine/tests/manual/nestededitable.js

@@ -34,9 +34,9 @@ class NestedEditable extends Plugin {
 		schema.register( 'figcaption' );
 		schema.extend( 'figure', { allowIn: '$root' } );
 		schema.extend( 'figcaption', { allowIn: 'figure' } );
-
-		schema.extend( '$inline', { allowIn: 'figure' } );
-		schema.extend( '$inline', { allowIn: 'figcaption' } );
+		schema.extend( '$text', {
+			allowIn: [ 'figure', 'figcaption' ]
+		} );
 
 		buildModelConverter().for( data.modelToView, editing.modelToView )
 			.fromElement( 'figure' )

+ 7 - 6
packages/ckeditor5-engine/tests/manual/tickets/1088/1.js

@@ -19,13 +19,14 @@ ClassicEditor
 	.then( editor => {
 		window.editor = editor;
 
-		const schema = editor.model.schema;
+		// const schema = editor.model.schema;
 
-		schema.disallow( { name: '$text', attributes: [ 'linkHref', 'italic' ], inside: 'heading1' } );
-		schema.disallow( { name: '$text', attributes: [ 'italic' ], inside: 'heading2' } );
-		schema.disallow( { name: '$text', attributes: [ 'linkHref' ], inside: 'blockQuote listItem' } );
-		schema.disallow( { name: '$text', attributes: [ 'bold' ], inside: 'paragraph' } );
-		schema.disallow( { name: 'heading3', inside: '$root' } );
+		// TODO this requires a callback
+		// schema.xdisallow( { name: '$text', attributes: [ 'linkHref', 'italic' ], inside: 'heading1' } );
+		// schema.xdisallow( { name: '$text', attributes: [ 'italic' ], inside: 'heading2' } );
+		// schema.xdisallow( { name: '$text', attributes: [ 'linkHref' ], inside: 'blockQuote listItem' } );
+		// schema.xdisallow( { name: '$text', attributes: [ 'bold' ], inside: 'paragraph' } );
+		// schema.xdisallow( { name: 'heading3', inside: '$root' } );
 	} )
 	.catch( err => {
 		console.error( err.stack );

+ 1 - 1
packages/ckeditor5-engine/tests/manual/tickets/475/1.js

@@ -31,7 +31,7 @@ class Link extends Plugin {
 		const editing = editor.editing;
 
 		// Allow bold attribute on all inline nodes.
-		editor.model.schema.allow( { name: '$inline', attributes: [ 'link' ] } );
+		editor.model.schema.extend( '$text', { allowAttributes: 'link' } );
 
 		// Build converter from model to view for data and editing pipelines.
 		buildModelConverter().for( data.modelToView, editing.modelToView )

+ 4 - 3
packages/ckeditor5-engine/tests/model/documentselection.js

@@ -947,12 +947,13 @@ describe( 'DocumentSelection', () => {
 				} );
 				model.schema.extend( 'image', { allowIn: '$root' } );
 				model.schema.extend( 'image', { allowIn: '$block' } );
-				model.schema.extend( '$inline', { allowIn: 'image' } );
 
 				model.schema.register( 'caption' );
-				model.schema.extend( '$inline', { allowIn: 'caption' } );
 				model.schema.extend( 'caption', { allowIn: 'image' } );
-				model.schema.allow( { name: '$text', attributes: 'bold', inside: 'caption' } );
+				model.schema.extend( '$text', {
+					allowIn: [ 'image', 'caption' ],
+					allowAttributes: 'bold'
+				} );
 			} );
 
 			it( 'ignores attributes inside an object if selection contains that object', () => {

+ 3 - 0
packages/ckeditor5-engine/tests/model/schema.js

@@ -1440,4 +1440,7 @@ describe( 'Schema', () => {
 	// * test the default abstract entities (in model.js)
 	// * see clipboardHolder definition (and rename it to the pastebin)
 	// * review insertContent's _tryAutoparagraphing()
+	// * it doesn't make sense for VCD to get schema as a param (it can get it from the model)
+	// * V->M conversion tests might got outdated and would need to be reviewed if someone has a spare week ;)
+	// * Do we need both $inline and $text?
 } );

+ 3 - 2
packages/ckeditor5-engine/tests/model/selection.js

@@ -1345,8 +1345,9 @@ describe( 'Selection', () => {
 		} );
 
 		it( 'returns false when the entire content except an empty element is selected', () => {
-			model.schema.register( 'img', { inheritAllFrom: '$inline' } );
-			model.schema.extend( 'img', { allowIn: 'p' } );
+			model.schema.register( 'img', {
+				allowIn: 'p'
+			} );
 
 			setData( model, '<p><img></img>[Foo]</p>' );
 

+ 28 - 33
packages/ckeditor5-engine/tests/model/utils/deletecontent.js

@@ -36,10 +36,8 @@ describe( 'DataController utils', () => {
 
 				const schema = model.schema;
 
-				schema.register( 'image', { inheritAllFrom: '$inline' } );
-
+				schema.register( 'image', { allowWhere: '$text' } );
 				schema.extend( '$text', { allowIn: '$root' } );
-				schema.extend( 'image', { allowIn: '$root' } );
 			} );
 
 			test(
@@ -101,11 +99,13 @@ describe( 'DataController utils', () => {
 
 				const schema = model.schema;
 
-				schema.register( 'image', { inheritAllFrom: '$inline' } );
+				schema.register( 'image', { allowWhere: '$text' } );
 				schema.register( 'paragraph', { inheritAllFrom: '$block' } );
 
-				schema.extend( '$text', { allowIn: '$root' } );
-				schema.allow( { name: '$text', attributes: [ 'bold', 'italic' ] } );
+				schema.extend( '$text', {
+					allowIn: '$root',
+					allowAttributes: [ 'bold', 'italic' ]
+				} );
 			} );
 
 			it( 'deletes characters (first half has attrs)', () => {
@@ -170,20 +170,16 @@ describe( 'DataController utils', () => {
 
 				const schema = model.schema;
 
-				schema.register( 'paragraph', { inheritAllFrom: '$block' } );
+				schema.register( 'paragraph', {
+					inheritAllFrom: '$block',
+					allowIn: 'pparent',
+					allowAttributes: 'align'
+				} );
 				schema.register( 'heading1', { inheritAllFrom: '$block' } );
-				schema.register( 'image', { inheritAllFrom: '$inline' } );
-				schema.register( 'pchild' );
-				schema.register( 'pparent' );
-
-				schema.extend( 'pchild', { allowIn: 'paragraph' } );
-				schema.extend( '$text', { allowIn: 'pchild' } );
-
-				schema.extend( 'paragraph', { allowIn: 'pparent' } );
-				schema.extend( 'pparent', { allowIn: '$root' } );
-				schema.extend( '$text', { allowIn: 'pparent' } );
-
-				schema.allow( { name: 'paragraph', attributes: [ 'align' ] } );
+				schema.register( 'image', { inheritAllFrom: '$text' } );
+				schema.register( 'pchild', { allowIn: 'paragraph' } );
+				schema.register( 'pparent', { allowIn: '$root' } );
+				schema.extend( '$text', { allowIn: [ 'pchild', 'pparent' ] } );
 			} );
 
 			test(
@@ -470,10 +466,12 @@ describe( 'DataController utils', () => {
 				beforeEach( () => {
 					const schema = model.schema;
 
-					schema.allow( { name: '$text', attributes: [ 'a', 'b' ], inside: 'paragraph' } );
-					schema.allow( { name: '$text', attributes: [ 'b', 'c' ], inside: 'pchild' } );
+					// TODO this requires a callback
+					// schema.xallow( { name: '$text', attributes: [ 'a', 'b' ], inside: 'paragraph' } );
+					// schema.xallow( { name: '$text', attributes: [ 'b', 'c' ], inside: 'pchild' } );
+					// schema.xdisallow( { name: '$text', attributes: [ 'c' ], inside: 'pchild pchild' } );
+
 					schema.extend( 'pchild', { allowIn: 'pchild' } );
-					schema.disallow( { name: '$text', attributes: [ 'c' ], inside: 'pchild pchild' } );
 				} );
 
 				test(
@@ -526,7 +524,7 @@ describe( 'DataController utils', () => {
 
 				const schema = model.schema;
 
-				schema.register( 'image', { inheritAllFrom: '$inline' } );
+				schema.register( 'image', { allowWhere: '$text' } );
 				schema.register( 'paragraph', { inheritAllFrom: '$block' } );
 				schema.register( 'heading1', { inheritAllFrom: '$block' } );
 				schema.register( 'blockWidget' );
@@ -647,16 +645,13 @@ describe( 'DataController utils', () => {
 				const schema = model.schema;
 
 				schema.register( 'inlineLimit', {
-					isLimit: true
+					isLimit: true,
+					allowIn: '$root'
 				} );
-				schema.extend( 'inlineLimit', { allowIn: '$root' } );
-				schema.extend( '$text', { allowIn: 'inlineLimit' } );
-
-				schema.extend( '$inline', { allowIn: '$root' } );
-
-				schema.register( 'x' );
-				schema.extend( '$text', { allowIn: 'x' } );
-				schema.extend( 'x', { allowIn: '$root' } );
+				schema.extend( '$text', {
+					allowIn: [ 'inlineLimit', '$root', 'x' ]
+				} );
+				schema.register( 'x', { allowIn: '$root' } );
 			} );
 
 			test(
@@ -764,7 +759,7 @@ describe( 'DataController utils', () => {
 				} );
 
 				schema.register( 'image', {
-					inheritAllFrom: '$inline',
+					allowWhere: '$text',
 					isObject: true
 				} );
 

+ 10 - 10
packages/ckeditor5-engine/tests/model/utils/getselectedcontent.js

@@ -34,12 +34,11 @@ describe( 'DataController utils', () => {
 
 				const schema = model.schema;
 
-				schema.register( 'image', { inheritAllFrom: '$inline' } );
-
-				schema.extend( '$text', { allowIn: '$root' } );
-				schema.extend( 'image', { allowIn: '$root' } );
-				schema.allow( { name: '$inline', attributes: [ 'bold' ] } );
-				schema.allow( { name: '$inline', attributes: [ 'italic' ] } );
+				schema.register( 'image', { allowWhere: '$text', allowIn: '$root' } );
+				schema.extend( '$text', {
+					allowIn: '$root',
+					allowAttributes: [ 'bold', 'italic' ]
+				} );
 			} );
 
 			it( 'returns empty fragment for no selection', () => {
@@ -132,13 +131,14 @@ describe( 'DataController utils', () => {
 				schema.register( 'heading1', { inheritAllFrom: '$block' } );
 				schema.register( 'blockImage' );
 				schema.register( 'caption' );
-				schema.register( 'image', { inheritAllFrom: '$inline' } );
+				schema.register( 'image', { allowWhere: '$text' } );
 
 				schema.extend( 'blockImage', { allowIn: '$root' } );
 				schema.extend( 'caption', { allowIn: 'blockImage' } );
-				schema.extend( '$inline', { allowIn: 'caption' } );
-
-				schema.allow( { name: '$inline', attributes: [ 'bold' ] } );
+				schema.extend( '$text', {
+					allowIn: 'caption',
+					allowAttributes: 'bold'
+				} );
 			} );
 
 			it( 'gets one character', () => {

+ 22 - 24
packages/ckeditor5-engine/tests/model/utils/insertcontent.js

@@ -66,7 +66,7 @@ describe( 'DataController utils', () => {
 
 			model.schema.register( 'paragraph', { inheritAllFrom: '$block' } );
 			model.schema.register( 'image', {
-				inheritAllFrom: '$inline',
+				allowWhere: '$text',
 				isObject: true
 			} );
 
@@ -86,7 +86,7 @@ describe( 'DataController utils', () => {
 				const schema = model.schema;
 
 				schema.register( 'image', {
-					inheritAllFrom: '$inline',
+					allowWhere: '$text',
 					isObject: true
 				} );
 				schema.register( 'disallowedElement' );
@@ -95,10 +95,10 @@ describe( 'DataController utils', () => {
 				schema.extend( 'image', { allowIn: '$root' } );
 				// Otherwise it won't be passed to the temporary model fragment used inside insert().
 				schema.extend( 'disallowedElement', { allowIn: '$clipboardHolder' } );
-				model.schema.extend( '$text', { allowIn: 'disallowedElement' } );
-
-				schema.allow( { name: '$inline', attributes: [ 'bold' ] } );
-				schema.allow( { name: '$inline', attributes: [ 'italic' ] } );
+				schema.extend( '$text', {
+					allowIn: 'disallowedElement',
+					allowAttributes: [ 'bold', 'italic' ]
+				} );
 			} );
 
 			it( 'inserts one text node', () => {
@@ -220,22 +220,17 @@ describe( 'DataController utils', () => {
 				schema.register( 'heading1', { inheritAllFrom: '$block' } );
 				schema.register( 'heading2', { inheritAllFrom: '$block' } );
 				schema.register( 'blockWidget', {
-					isObject: true
+					isObject: true,
+					allowIn: '$root'
 				} );
 				schema.register( 'inlineWidget', {
-					isObject: true
+					isObject: true,
+					allowIn: [ '$block', '$clipboardHolder' ],
 				} );
-				schema.register( 'listItem', { inheritAllFrom: '$block' } );
-
-				schema.extend( 'blockWidget', { allowIn: '$root' } );
-				schema.extend( 'inlineWidget', { allowIn: '$block' } );
-				schema.extend( 'inlineWidget', { allowIn: '$clipboardHolder' } );
-				schema.allow( {
-					name: 'listItem',
-					inside: '$root',
-					attributes: [ 'type', 'indent' ]
+				schema.register( 'listItem', {
+					inheritAllFrom: '$block',
+					allowAttributes: [ 'type', 'indent' ]
 				} );
-				schema.requireAttributes( 'listItem', [ 'type', 'indent' ] );
 			} );
 
 			it( 'inserts one text node', () => {
@@ -277,7 +272,8 @@ describe( 'DataController utils', () => {
 			} );
 
 			it( 'not insert autoparagraph when paragraph is disallowed at the current position', () => {
-				model.schema.disallow( { name: 'paragraph', inside: '$root' } );
+				// TODO this requires a callback
+				// model.schema.xdisallow( { name: 'paragraph', inside: '$root' } );
 
 				const content = new DocumentFragment( [
 					new Element( 'heading1', [], [ new Text( 'bar' ) ] ),
@@ -612,11 +608,13 @@ describe( 'DataController utils', () => {
 
 				schema.extend( 'element', { allowIn: 'paragraph' } );
 				schema.extend( 'element', { allowIn: 'heading1' } );
-				schema.allow( { name: '$text', attributes: 'b', inside: 'paragraph' } );
-				schema.allow( { name: '$text', attributes: [ 'b' ], inside: 'paragraph element' } );
-				schema.allow( { name: '$text', attributes: [ 'a', 'b' ], inside: 'heading1 element' } );
-				schema.allow( { name: '$text', attributes: [ 'a', 'b' ], inside: 'td element' } );
-				schema.allow( { name: '$text', attributes: [ 'b' ], inside: 'element table td' } );
+
+				// TODO this requires a callback
+				// schema.xallow( { name: '$text', attributes: 'b', inside: 'paragraph' } );
+				// schema.xallow( { name: '$text', attributes: [ 'b' ], inside: 'paragraph element' } );
+				// schema.xallow( { name: '$text', attributes: [ 'a', 'b' ], inside: 'heading1 element' } );
+				// schema.xallow( { name: '$text', attributes: [ 'a', 'b' ], inside: 'td element' } );
+				// schema.xallow( { name: '$text', attributes: [ 'b' ], inside: 'element table td' } );
 			} );
 
 			it( 'filters out disallowed elements and leaves out the text', () => {

+ 1 - 1
packages/ckeditor5-engine/tests/model/utils/modifyselection.js

@@ -420,7 +420,7 @@ describe( 'DataController utils', () => {
 				model.schema.extend( '$text', { allowIn: 'obj' } );
 
 				model.schema.register( 'inlineObj', {
-					inheritAllFrom: '$inline',
+					allowIn: 'p',
 					isObject: true
 				} );
 				model.schema.extend( '$text', { allowIn: 'inlineObj' } );