|
|
@@ -536,6 +536,10 @@ describe( 'Model', () => {
|
|
|
schema.register( 'image', {
|
|
|
isObject: true
|
|
|
} );
|
|
|
+ schema.register( 'content', {
|
|
|
+ inheritAllFrom: '$block',
|
|
|
+ isContent: true
|
|
|
+ } );
|
|
|
schema.extend( 'image', { allowIn: 'div' } );
|
|
|
schema.register( 'listItem', {
|
|
|
inheritAllFrom: '$block'
|
|
|
@@ -545,15 +549,19 @@ describe( 'Model', () => {
|
|
|
model,
|
|
|
|
|
|
'<div>' +
|
|
|
- '<paragraph></paragraph>' +
|
|
|
+ '<paragraph></paragraph>' +
|
|
|
'</div>' +
|
|
|
'<paragraph>foo</paragraph>' +
|
|
|
'<div>' +
|
|
|
- '<image></image>' +
|
|
|
+ '<image></image>' +
|
|
|
'</div>' +
|
|
|
'<listItem></listItem>' +
|
|
|
'<listItem></listItem>' +
|
|
|
- '<listItem></listItem>'
|
|
|
+ '<listItem></listItem>' +
|
|
|
+ '<content>foo</content>' +
|
|
|
+ '<div>' +
|
|
|
+ '<content></content>' +
|
|
|
+ '</div>'
|
|
|
);
|
|
|
|
|
|
root = model.document.getRoot();
|
|
|
@@ -762,6 +770,19 @@ describe( 'Model', () => {
|
|
|
expect( model.hasContent( pEmpty, { ignoreMarkers: true } ) ).to.be.true;
|
|
|
expect( model.hasContent( pEmpty, { ignoreMarkers: true, ignoreWhitespaces: true } ) ).to.be.false;
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'should return true for an item registered as a content (isContent=true, isObject=false) in the schema', () => {
|
|
|
+ const contentElement = root.getChild( 6 );
|
|
|
+
|
|
|
+ expect( model.hasContent( contentElement ) ).to.be.true;
|
|
|
+ } );
|
|
|
+
|
|
|
+ it( 'should return true if a range contains an item registered as a content (isContent=true, isObject=false) in the schema', () => {
|
|
|
+ // [<div><content></content></div>]
|
|
|
+ const range = new ModelRange( ModelPosition._createAt( root, 6 ), ModelPosition._createAt( root, 7 ) );
|
|
|
+
|
|
|
+ expect( model.hasContent( range ) ).to.be.true;
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
describe( 'createPositionFromPath()', () => {
|