8
0
Просмотр исходного кода

Merge branch 't/ckeditor5-core/90'

Tests: Updated tests to match changes in the core.
Piotrek Koszuliński 8 лет назад
Родитель
Сommit
3009a66bcc
1 измененных файлов с 21 добавлено и 3 удалено
  1. 21 3
      packages/ckeditor5-undo/tests/undo.js

+ 21 - 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;
@@ -64,11 +74,19 @@ describe( 'Undo', () => {
 
 	it( 'should set CTRL+SHIFT+Z keystroke', () => {
 		const spy = sinon.stub( editor, 'execute' );
+		const keyEventData = {
+			keyCode: keyCodes.z,
+			ctrlKey: true,
+			shiftKey: true,
+			preventDefault: sinon.spy(),
+			stopPropagation: sinon.spy()
+		};
 
-		const wasHandled = editor.keystrokes.press( { keyCode: keyCodes.z, ctrlKey: true, shiftKey: true } );
+		const wasHandled = editor.keystrokes.press( keyEventData );
 
 		expect( wasHandled ).to.be.true;
 		expect( spy.calledWithExactly( 'redo' ) ).to.be.true;
+		expect( keyEventData.preventDefault.calledOnce ).to.be.true;
 	} );
 
 	function testButton( featureName, label, featureKeystroke ) {