@skitterm wrote:
I have an input that triggers an action when
enter
key is pressed. I’ve tried programmatically simulating that event in my integration test but have fallen short.How would I go about doing that?I’ve seen the handy-dandy keyEvent and triggerEvent test helpers. I tried using those with my integration test but got an error that
keyEvent is not defined
. I’m assuming these are only usable in acceptance tests?In my test, I tried triggering the enter event with jQuery, like this:
Ember.run(() => { const event = $.Event('keyup'); event.which = 13; event.keyCode = 13; this.$('.my-input').focus(); this.$('.my-input').trigger(event); });
But I got a
this.get() is not defined
error. My event handlers for the enter key were getting fired, so my guess is the event was triggered twice (as the docs warn about with triggering events with jQuery).Any ideas?
Posts: 1
Participants: 1