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

Add more table selection scenarios.

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

+ 84 - 0
packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js

@@ -686,6 +686,90 @@ describe( 'Selection post-fixer', () => {
 				);
 			} );
 
+			it( 'should allow multi-range selection on continues blocks (row selected)', () => {
+				setModelData( model,
+					'<table>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A1</paragraph></tableCell>' +
+							'<tableCell><paragraph>B1</paragraph></tableCell>' +
+							'<tableCell><paragraph>C1</paragraph></tableCell>' +
+						'</tableRow>' +
+						'<tableRow>' +
+							'[<tableCell><paragraph>A2</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>B2</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>C2</paragraph></tableCell>]' +
+						'</tableRow>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A3</paragraph></tableCell>' +
+							'<tableCell><paragraph>B3</paragraph></tableCell>' +
+							'<tableCell><paragraph>C3</paragraph></tableCell>' +
+						'</tableRow>' +
+					'</table>'
+				);
+
+				assertEqualMarkup( getModelData( model ),
+					'<table>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A1</paragraph></tableCell>' +
+							'<tableCell><paragraph>B1</paragraph></tableCell>' +
+							'<tableCell><paragraph>C1</paragraph></tableCell>' +
+						'</tableRow>' +
+						'<tableRow>' +
+							'[<tableCell><paragraph>A2</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>B2</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>C2</paragraph></tableCell>]' +
+						'</tableRow>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A3</paragraph></tableCell>' +
+							'<tableCell><paragraph>B3</paragraph></tableCell>' +
+							'<tableCell><paragraph>C3</paragraph></tableCell>' +
+						'</tableRow>' +
+					'</table>'
+				);
+			} );
+
+			it( 'should allow multi-range selection with mixed continues/non-continues blocks (part of table selected)', () => {
+				setModelData( model,
+					'<table>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A1</paragraph></tableCell>' +
+							'<tableCell><paragraph>B1</paragraph></tableCell>' +
+							'<tableCell><paragraph>C1</paragraph></tableCell>' +
+						'</tableRow>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A2</paragraph></tableCell>' +
+							'[<tableCell><paragraph>B2</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>C2</paragraph></tableCell>]' +
+						'</tableRow>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A3</paragraph></tableCell>' +
+							'[<tableCell><paragraph>B3</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>C3</paragraph></tableCell>]' +
+						'</tableRow>' +
+					'</table>'
+				);
+
+				assertEqualMarkup( getModelData( model ),
+					'<table>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A1</paragraph></tableCell>' +
+							'<tableCell><paragraph>B1</paragraph></tableCell>' +
+							'<tableCell><paragraph>C1</paragraph></tableCell>' +
+						'</tableRow>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A2</paragraph></tableCell>' +
+							'[<tableCell><paragraph>B2</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>C2</paragraph></tableCell>]' +
+							'</tableRow>' +
+						'<tableRow>' +
+							'<tableCell><paragraph>A3</paragraph></tableCell>' +
+							'[<tableCell><paragraph>B3</paragraph></tableCell>]' +
+							'[<tableCell><paragraph>C3</paragraph></tableCell>]' +
+						'</tableRow>' +
+					'</table>'
+				);
+			} );
+
 			it( 'should not fix ranges in multi-range selection (each range set differently - but valid)', () => {
 				setModelData( model,
 					'<paragraph>[foo]</paragraph>' +