8
0
Просмотр исходного кода

Tests: changed test to better reflect original issue.

Szymon Cofalik 8 лет назад
Родитель
Сommit
68e184b450
1 измененных файлов с 6 добавлено и 8 удалено
  1. 6 8
      packages/ckeditor5-image/tests/imagecaption/imagecaptionengine.js

+ 6 - 8
packages/ckeditor5-image/tests/imagecaption/imagecaptionengine.js

@@ -248,17 +248,15 @@ describe( 'ImageCaptionEngine', () => {
 			const caption = new ModelElement( 'caption' );
 			const batch = document.batch();
 
-			// When first change to the document will be made - manually add caption to the image element.
-			document.once( 'change', () => {
-				document.enqueueChanges( () => {
-					batch.insert( ModelPosition.createAt( image ), caption );
-				} );
-			}, { priority: 'high' } );
-
 			document.enqueueChanges( () => {
-				batch.insert( ModelPosition.createAt( document.getRoot() ), image );
+				batch
+					// Since we are adding an empty image, this should trigger caption fixer.
+					.insert( ModelPosition.createAt( document.getRoot() ), image )
+					// Add caption just after the image is inserted, in same batch and enqueue changes block.
+					.insert( ModelPosition.createAt( image ), caption );
 			} );
 
+			// Check whether caption fixer added redundant caption.
 			expect( getModelData( document ) ).to.equal(
 				'[]<image alt="" src=""><caption></caption></image>'
 			);