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