Browse Source

Added test for Ctrl+space keystroke handler.

Oskar Wróbel 6 years ago
parent
commit
e191e9127d
1 changed files with 27 additions and 0 deletions
  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 );
 			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 );
+		} );
+	} );
 } );
 } );