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

Added tests checking if image is inserted correctly when selection is in the middle of the block.

Szymon Kupś 8 лет назад
Родитель
Сommit
cb928c97ae
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      packages/ckeditor5-upload/tests/imageuploadcommand.js

+ 10 - 0
packages/ckeditor5-upload/tests/imageuploadcommand.js

@@ -58,6 +58,16 @@ describe( 'ImageUploadCommand', () => {
 			expect( getModelData( document ) ).to.equal( `<paragraph>foo</paragraph>[<image uploadId="${ id }"></image>]` );
 			expect( getModelData( document ) ).to.equal( `<paragraph>foo</paragraph>[<image uploadId="${ id }"></image>]` );
 		} );
 		} );
 
 
+		it( 'should insert image before block if selection is in the middle', () => {
+			const file = createNativeFileMock();
+			setModelData( document, '<paragraph>f{}oo</paragraph>' );
+
+			command._doExecute( { file } );
+
+			const id = fileRepository.getLoader( file ).id;
+			expect( getModelData( document ) ).to.equal( `[<image uploadId="${ id }"></image>]<paragraph>foo</paragraph>` );
+		} );
+
 		it( 'should insert image after other image', () => {
 		it( 'should insert image after other image', () => {
 			const file = createNativeFileMock();
 			const file = createNativeFileMock();
 			setModelData( document, '[<image src="image.png"></image>]' );
 			setModelData( document, '[<image src="image.png"></image>]' );