refactored test for the keyEventHandler