|
|
@@ -26,11 +26,17 @@ describe( 'EnterCommand', () => {
|
|
|
schema.registerItem( 'img', '$inline' );
|
|
|
schema.registerItem( 'p', '$block' );
|
|
|
schema.registerItem( 'h', '$block' );
|
|
|
- schema.registerItem( 'w' );
|
|
|
- schema.allow( { name: 'w', inside: '$root' } );
|
|
|
- schema.allow( { name: '$text', inside: 'w' } );
|
|
|
- schema.limits.add( 'w' );
|
|
|
+ schema.registerItem( 'inlineLimit' );
|
|
|
+ schema.registerItem( 'blockLimit' );
|
|
|
+
|
|
|
+ schema.allow( { name: 'inlineLimit', inside: 'p' } );
|
|
|
+ schema.allow( { name: '$text', inside: 'inlineLimit' } );
|
|
|
schema.allow( { name: '$text', inside: '$root' } );
|
|
|
+ schema.allow( { name: 'blockLimit', inside: '$root' } );
|
|
|
+ schema.allow( { name: 'p', inside: 'blockLimit' } );
|
|
|
+
|
|
|
+ schema.limits.add( 'inlineLimit' );
|
|
|
+ schema.limits.add( 'blockLimit' );
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
@@ -112,27 +118,27 @@ describe( 'EnterCommand', () => {
|
|
|
);
|
|
|
|
|
|
test(
|
|
|
- 'should not break limit elements - collapsed',
|
|
|
- '<w>foo[]bar</w>',
|
|
|
- '<w>foo[]bar</w>'
|
|
|
+ 'should not break inline limit elements - collapsed',
|
|
|
+ '<p><inlineLimit>foo[]bar</inlineLimit></p>',
|
|
|
+ '<p><inlineLimit>foo[]bar</inlineLimit></p>'
|
|
|
);
|
|
|
|
|
|
test(
|
|
|
- 'should not break limit elements',
|
|
|
- '<w>foo[bar]baz</w>',
|
|
|
- '<w>foo[bar]baz</w>'
|
|
|
+ 'should not break inline limit elements',
|
|
|
+ '<p><inlineLimit>foo[bar]baz</inlineLimit></p>',
|
|
|
+ '<p><inlineLimit>foo[bar]baz</inlineLimit></p>'
|
|
|
);
|
|
|
|
|
|
test(
|
|
|
- 'should not break limit elements - selection partially inside',
|
|
|
- '<p>fo[o</p><w>ba]r</w>',
|
|
|
- '<p>fo[o</p><w>ba]r</w>'
|
|
|
+ 'should not break inline limit elements - selection partially inside',
|
|
|
+ '<p><inlineLimit>ba[r</inlineLimit></p><p>f]oo</p>',
|
|
|
+ '<p><inlineLimit>ba[r</inlineLimit></p><p>f]oo</p>'
|
|
|
);
|
|
|
|
|
|
test(
|
|
|
- 'should delete limit element when fully contained inside selection',
|
|
|
- '<p>fo[o</p><w>bar</w><p>ba]z</p>',
|
|
|
- '<p>fo</p><p>[]z</p>'
|
|
|
+ 'should break paragraph in blockLimit',
|
|
|
+ '<blockLimit><p>foo[]bar</p></blockLimit>',
|
|
|
+ '<blockLimit><p>foo</p><p>[]bar</p></blockLimit>'
|
|
|
);
|
|
|
|
|
|
it( 'leaves one empty element after two were fully selected (backward)', () => {
|