Browse Source

Tests: Added test ensuring that consumed image size attributes are not handled by the image resize plugin.

Marek Lewandowski 5 years ago
parent
commit
d1a30ee68c
1 changed files with 12 additions and 0 deletions
  1. 12 0
      packages/ckeditor5-image/tests/imageresize.js

+ 12 - 0
packages/ckeditor5-image/tests/imageresize.js

@@ -84,6 +84,18 @@ describe( 'ImageResize', () => {
 			expect( editor.getData() )
 				.to.equal( `<figure class="image image_resized" style="width:50%;"><img src="${ IMAGE_SRC_FIXTURE }"></figure>` );
 		} );
+
+		it( 'doesn\'t downcast consumed tokens', () => {
+			editor.conversion.for( 'downcast' ).add( dispatcher =>
+				dispatcher.on( 'attribute:width:image', ( evt, data, conversionApi ) => {
+					conversionApi.consumable.consume( data.item, 'attribute:width:image' );
+				}, { priority: 'high' } )
+			);
+			setData( editor.model, `<image src="${ IMAGE_SRC_FIXTURE }" width="50%"></image>` );
+
+			expect( editor.getData() )
+				.to.equal( `<figure class="image"><img src="${ IMAGE_SRC_FIXTURE }"></figure>` );
+		} );
 	} );
 
 	describe( 'schema', () => {