Parcourir la source

Tests: Updated tests after tthe refactoring in the EditingKeystrokeHandler. See ckeditor/ckeditor5-core#90.

Aleksander Nowodzinski il y a 8 ans
Parent
commit
c46c489207
1 fichiers modifiés avec 19 ajouts et 3 suppressions
  1. 19 3
      packages/ckeditor5-undo/tests/undo.js

+ 19 - 3
packages/ckeditor5-undo/tests/undo.js

@@ -47,7 +47,12 @@ describe( 'Undo', () => {
 	it( 'should set CTRL+Z keystroke', () => {
 		const spy = sinon.stub( editor, 'execute' );
 
-		const wasHandled = editor.keystrokes.press( { keyCode: keyCodes.z, ctrlKey: true } );
+		const wasHandled = editor.keystrokes.press( {
+			keyCode: keyCodes.z,
+			ctrlKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		} );
 
 		expect( wasHandled ).to.be.true;
 		expect( spy.calledWithExactly( 'undo' ) ).to.be.true;
@@ -56,7 +61,12 @@ describe( 'Undo', () => {
 	it( 'should set CTRL+Y keystroke', () => {
 		const spy = sinon.stub( editor, 'execute' );
 
-		const wasHandled = editor.keystrokes.press( { keyCode: keyCodes.y, ctrlKey: true } );
+		const wasHandled = editor.keystrokes.press( {
+			keyCode: keyCodes.y,
+			ctrlKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		} );
 
 		expect( wasHandled ).to.be.true;
 		expect( spy.calledWithExactly( 'redo' ) ).to.be.true;
@@ -65,7 +75,13 @@ describe( 'Undo', () => {
 	it( 'should set CTRL+SHIFT+Z keystroke', () => {
 		const spy = sinon.stub( editor, 'execute' );
 
-		const wasHandled = editor.keystrokes.press( { keyCode: keyCodes.z, ctrlKey: true, shiftKey: true } );
+		const wasHandled = editor.keystrokes.press( {
+			keyCode: keyCodes.z,
+			ctrlKey: true,
+			shiftKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		} );
 
 		expect( wasHandled ).to.be.true;
 		expect( spy.calledWithExactly( 'redo' ) ).to.be.true;