Can someone explain why this test fails?


I’m using keycode 72 for demonstration purposes. In my app I’m trying to trigger an enter with keycode 13.



I believe that you can’t programmatically trigger keyboard events like that, for security reasons. The event is received, but no text is entered into the field.

If you are just wanting to trigger an event, though, it works. When I added this line to your JSBin, the console output happened:

find('input').keypress(function() { console.log("hey!"); });


Thanks, maybe you can help me get the test to do what I actually want though. So I have an input set up that on enter fires an action. How would I go about firing an ‘enter’? I was trying keyEvent('input', 'keyup', 13); but that didn’t work.


I modified the JS Bin, the test is able to trigger an enter event on the input. Is that what you need?


Yes, that works! For some reason I only tried keydown and keypress, but I guess I needed to be using keydown. Thank you so much - I thought I was going crazy!