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

Added test for Ctrl+space keystroke handler.

Oskar Wróbel 6 лет назад
Родитель
Сommit
e191e9127d
1 измененных файлов с 27 добавлено и 0 удалено
  1. 27 0
      packages/ckeditor5-list/tests/todolistediting.js

+ 27 - 0
packages/ckeditor5-list/tests/todolistediting.js

@@ -836,4 +836,31 @@ describe( 'TodoListEditing', () => {
 			sinon.assert.notCalled( domEvtDataStub.stopPropagation );
 		} );
 	} );
+
+	describe( 'Ctrl+space keystroke handling', () => {
+		let domEvtDataStub;
+
+		beforeEach( () => {
+			domEvtDataStub = {
+				keyCode: getCode( 'space' ),
+				ctrlKey: true,
+				preventDefault: sinon.spy(),
+				stopPropagation: sinon.spy()
+			};
+		} );
+
+		it( 'should execute TodoListCheckCommand', () => {
+			const command = editor.commands.get( 'todoListCheck' );
+
+			sinon.spy( command, 'execute' );
+
+			viewDoc.fire( 'keydown', domEvtDataStub );
+
+			sinon.assert.calledOnce( command.execute );
+
+			viewDoc.fire( 'keydown', domEvtDataStub );
+
+			sinon.assert.calledTwice( command.execute );
+		} );
+	} );
 } );