Ver Fonte

Add stub test for bigger selection than pasted table case.

Maciej Gołaszewski há 5 anos atrás
pai
commit
32ed5df477
1 ficheiros alterados com 31 adições e 3 exclusões
  1. 31 3
      packages/ckeditor5-table/tests/tableclipboard.js

+ 31 - 3
packages/ckeditor5-table/tests/tableclipboard.js

@@ -1154,7 +1154,7 @@ describe( 'table clipboard', () => {
 						/* eslint-disable no-multi-spaces */
 						/* eslint-disable no-multi-spaces */
 						assertSelectedCells( model, [
 						assertSelectedCells( model, [
 							[ 0, 0, 0, 0 ],
 							[ 0, 0, 0, 0 ],
-							[ 0, 1,    0 ],
+							[ 0, 1, 0 ],
 							[ 0, 1, 1, 0 ],
 							[ 0, 1, 1, 0 ],
 							[ 0, 0, 0, 0 ]
 							[ 0, 0, 0, 0 ]
 						] );
 						] );
@@ -1163,7 +1163,7 @@ describe( 'table clipboard', () => {
 				} );
 				} );
 			} );
 			} );
 
 
-			describe( 'pasted table is smaller than the selected area', () => {
+			describe( 'pasted table is bigger than the selected area', () => {
 				describe( 'no spans', () => {
 				describe( 'no spans', () => {
 					it( 'handles simple table paste to a simple table fragment - at the beginning of a table', () => {
 					it( 'handles simple table paste to a simple table fragment - at the beginning of a table', () => {
 						tableSelection.setCellSelection(
 						tableSelection.setCellSelection(
@@ -1872,7 +1872,7 @@ describe( 'table clipboard', () => {
 						/* eslint-disable no-multi-spaces */
 						/* eslint-disable no-multi-spaces */
 						assertSelectedCells( model, [
 						assertSelectedCells( model, [
 							[ 0, 0, 0, 0 ],
 							[ 0, 0, 0, 0 ],
-							[ 0, 1,    0 ],
+							[ 0, 1, 0 ],
 							[ 0, 1, 1, 0 ],
 							[ 0, 1, 1, 0 ],
 							[ 0, 0, 0, 0 ]
 							[ 0, 0, 0, 0 ]
 						] );
 						] );
@@ -1880,6 +1880,34 @@ describe( 'table clipboard', () => {
 					} );
 					} );
 				} );
 				} );
 			} );
 			} );
+
+			describe( 'pasted table is smaller than the selected area', () => {
+				it( 'blocks this case', () => {
+					tableSelection.setCellSelection(
+						modelRoot.getNodeByPath( [ 0, 0, 0 ] ),
+						modelRoot.getNodeByPath( [ 0, 3, 3 ] )
+					);
+
+					pasteTable( [
+						[ 'aa', 'ab' ],
+						[ 'ba', 'bb' ]
+					] );
+
+					assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
+						[ '00', '01', '02', '03' ],
+						[ '10', '11', '12', '13' ],
+						[ '20', '21', '22', '23' ],
+						[ '30', '31', '32', '33' ]
+					] ) );
+
+					assertSelectedCells( model, [
+						[ 1, 1, 1, 1 ],
+						[ 1, 1, 1, 1 ],
+						[ 1, 1, 1, 1 ],
+						[ 1, 1, 1, 1 ]
+					] );
+				} );
+			} );
 		} );
 		} );
 	} );
 	} );