Explorar el Código

Restored table pasting test.

Kuba Niegowski hace 5 años
padre
commit
cbe22fe637
Se han modificado 1 ficheros con 24 adiciones y 0 borrados
  1. 24 0
      packages/ckeditor5-table/tests/tableclipboard-paste.js

+ 24 - 0
packages/ckeditor5-table/tests/tableclipboard-paste.js

@@ -124,6 +124,30 @@ describe( 'table clipboard', () => {
 			] ) );
 		} );
 
+		it( 'should not alter model.insertContent if selection is outside table', () => {
+			model.change( writer => {
+				writer.insertElement( 'paragraph', modelRoot.getChild( 0 ), 'before' );
+				writer.setSelection( modelRoot.getChild( 0 ), 'before' );
+			} );
+
+			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 ), '<paragraph>foo[]</paragraph>' + modelTable( [
+				[ '00', '01', '02', '03' ],
+				[ '10', '11', '12', '13' ],
+				[ '20', '21', '22', '23' ],
+				[ '30', '31', '32', '33' ]
+			] ) );
+		} );
+
 		it( 'should normalize pasted table if selection is outside table', () => {
 			model.change( writer => {
 				writer.insertElement( 'paragraph', modelRoot.getChild( 0 ), 'before' );