handle key input for test