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

Add tests for blockQuote in table in selection post-fixer tests.

Maciej Gołaszewski 7 лет назад
Родитель
Сommit
54f97f1334
1 измененных файлов с 34 добавлено и 1 удалено
  1. 34 1
      packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js

+ 34 - 1
packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js

@@ -407,7 +407,7 @@ describe( 'Selection post-fixer', () => {
 				);
 			} );
 
-			it( 'should not fix #3 - selection over image & paragraph in table', () => {
+			it( 'should not fix #4 - selection over image & paragraph in table', () => {
 				setModelData( model,
 					'<paragraph>foo</paragraph>' +
 					'<table>' +
@@ -435,6 +435,39 @@ describe( 'Selection post-fixer', () => {
 				);
 			} );
 
+			it( 'should not fix #4 - selection over blockQuote in table', () => {
+				model.schema.register( 'blockQuote', {
+					allowWhere: '$block',
+					allowContentOf: '$root'
+				} );
+
+				setModelData( model,
+					'<paragraph>foo</paragraph>' +
+					'<table>' +
+						'<tableRow>' +
+							'<tableCell><blockQuote><paragraph>foo</paragraph></blockQuote></tableCell>' +
+							'<tableCell><paragraph>[]bbb</paragraph></tableCell>' +
+						'</tableRow>' +
+					'</table>'
+				);
+
+				model.change( writer => {
+					const tableCell = model.document.getRoot().getNodeByPath( [ 1, 0, 0 ] );
+
+					writer.setSelection( writer.createRangeIn( tableCell ) );
+				} );
+
+				expect( getModelData( model ) ).to.equal(
+					'<paragraph>foo</paragraph>' +
+					'<table>' +
+						'<tableRow>' +
+							'<tableCell><blockQuote><paragraph>[foo]</paragraph></blockQuote></tableCell>' +
+							'<tableCell><paragraph>bbb</paragraph></tableCell>' +
+						'</tableRow>' +
+					'</table>'
+				);
+			} );
+
 			it( 'should fix multiple ranges #1', () => {
 				model.change( writer => {
 					const ranges = [