瀏覽代碼

Add test for pasting when no table cells are selected.

Maciej Gołaszewski 5 年之前
父節點
當前提交
8b90a88304
共有 1 個文件被更改,包括 19 次插入0 次删除
  1. 19 0
      packages/ckeditor5-table/tests/tableclipboard.js

+ 19 - 0
packages/ckeditor5-table/tests/tableclipboard.js

@@ -434,6 +434,25 @@ describe( 'table clipboard', () => {
 					sinon.assert.calledOnce( data.preventDefault );
 				} );
 
+				it( 'should allow normal paste if no table cells are selected', () => {
+					const data = {
+						dataTransfer: createDataTransfer(),
+						preventDefault: sinon.spy(),
+						stopPropagation: sinon.spy()
+					};
+					data.dataTransfer.setData( 'text/html', '<p>foo</p>' );
+					viewDocument.fire( 'paste', data );
+
+					editor.isReadOnly = false;
+
+					assertEqualMarkup( getModelData( model ), modelTable( [
+						[ '00foo[]', '01', '02', '03' ],
+						[ '10', '11', '12', '13' ],
+						[ '20', '21', '22', '23' ],
+						[ '30', '31', '32', '33' ]
+					] ) );
+				} );
+
 				it( 'pastes simple table to a simple table fragment - at the beginning of a table', () => {
 					tableSelection._setCellSelection(
 						modelRoot.getNodeByPath( [ 0, 0, 0 ] ),