8
0
Эх сурвалжийг харах

Other: Added caption to limits set in schema.
Tests: CHecking if caption is added to limits set in schema.

Szymon Kupś 9 жил өмнө
parent
commit
4c0bfe01f0

+ 1 - 0
packages/ckeditor5-image/src/imagecaption/imagecaptionengine.js

@@ -51,6 +51,7 @@ export default class ImageCaptionEngine extends Plugin {
 		schema.registerItem( 'caption' );
 		schema.allow( { name: '$inline', inside: 'caption' } );
 		schema.allow( { name: 'caption', inside: 'image' } );
+		schema.limits.add( 'caption' );
 
 		// Add caption element to each image inserted without it.
 		document.on( 'change', insertMissingCaptionElement );

+ 2 - 1
packages/ckeditor5-image/tests/imagecaption/imagecaptionengine.js

@@ -42,9 +42,10 @@ describe( 'ImageCaptionEngine', () => {
 		expect( editor.plugins.get( ImageCaptionEngine ) ).to.be.instanceOf( ImageCaptionEngine );
 	} );
 
-	it( 'should set proper schema rules', () => {
+	it.only( 'should set proper schema rules', () => {
 		expect( document.schema.check( { name: 'caption', iniside: 'image' } ) ).to.be.true;
 		expect( document.schema.check( { name: '$inline', inside: 'caption' } ) ).to.be.true;
+		expect( document.schema.limits.has( 'caption' ) );
 	} );
 
 	describe( 'data pipeline', () => {