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

Tests: Added basic test cases for removing rows with multiple selected cells.

Marek Lewandowski 5 лет назад
Родитель
Сommit
1f8ccc06ab
1 измененных файлов с 39 добавлено и 0 удалено
  1. 39 0
      packages/ckeditor5-table/tests/commands/removerowcommand.js

+ 39 - 0
packages/ckeditor5-table/tests/commands/removerowcommand.js

@@ -85,6 +85,45 @@ describe( 'RemoveRowCommand', () => {
 			] ) );
 			] ) );
 		} );
 		} );
 
 
+		it( 'should remove a row if all its cells are selected', () => {
+			setData( model, modelTable( [
+				[ '00', '01' ],
+				[ '10', '11' ],
+				[ '20', '21' ]
+			] ) );
+
+			const tableSelection = editor.plugins.get( TableSelection );
+			const modelRoot = model.document.getRoot();
+			tableSelection.startSelectingFrom( modelRoot.getNodeByPath( [ 0, 1, 0 ] ) );
+			tableSelection.setSelectingTo( modelRoot.getNodeByPath( [ 0, 1, 1 ] ) );
+
+			command.execute();
+
+			assertEqualMarkup( getData( model ), modelTable( [
+				[ '00', '01' ],
+				[ '[]20', '21' ]
+			] ) );
+		} );
+
+		it( 'should remove multiple rows if more than one row is selected', () => {
+			setData( model, modelTable( [
+				[ '00', '01' ],
+				[ '10', '11' ],
+				[ '20', '21' ]
+			] ) );
+
+			const tableSelection = editor.plugins.get( TableSelection );
+			const modelRoot = model.document.getRoot();
+			tableSelection.startSelectingFrom( modelRoot.getNodeByPath( [ 0, 1, 0 ] ) );
+			tableSelection.setSelectingTo( modelRoot.getNodeByPath( [ 0, 2, 0 ] ) );
+
+			command.execute();
+
+			assertEqualMarkup( getData( model ), modelTable( [
+				[ '00', '01[]' ]
+			] ) );
+		} );
+
 		it( 'should remove a given row from a table start', () => {
 		it( 'should remove a given row from a table start', () => {
 			setData( model, modelTable( [
 			setData( model, modelTable( [
 				[ '[]00', '01' ],
 				[ '[]00', '01' ],