Browse Source

Tests: Added integration test for cutting.

Szymon Cofalik 7 years ago
parent
commit
88295cb6dc
1 changed files with 19 additions and 2 deletions
  1. 19 2
      packages/ckeditor5-undo/tests/undoengine-integration.js

+ 19 - 2
packages/ckeditor5-undo/tests/undoengine-integration.js

@@ -918,7 +918,7 @@ describe( 'UndoEngine integration', () => {
 		} );
 	} );
 
-	describe( 'pasting', () => {
+	describe( 'clipboard', () => {
 		function pasteHtml( editor, html ) {
 			editor.editing.view.document.fire( 'paste', {
 				dataTransfer: createDataTransfer( { 'text/html': html } ),
@@ -930,7 +930,8 @@ describe( 'UndoEngine integration', () => {
 			return {
 				getData( type ) {
 					return data[ type ];
-				}
+				},
+				setData() {}
 			};
 		}
 
@@ -958,6 +959,22 @@ describe( 'UndoEngine integration', () => {
 			editor.execute( 'undo' );
 			output( '<paragraph>Foo[]</paragraph>' );
 		} );
+
+		// ckeditor5#781
+		it( 'cutting should not create empty undo step', () => {
+			input( '<paragraph>Fo[oba]r</paragraph>' );
+
+			editor.editing.view.document.fire( 'cut', {
+				dataTransfer: createDataTransfer(),
+				preventDefault() {},
+				method: 'cut'
+			} );
+
+			editor.execute( 'undo' );
+
+			output( '<paragraph>Fo[oba]r</paragraph>' );
+			undoDisabled();
+		} );
 	} );
 
 	describe( 'other edge cases', () => {