How to focus / blur a component in ember integration tests?

How can I trigger focus and blur events when testing the Ember.js component?

this.$().focus(); or this.$('input').focus(); seems to work, but behaves differently in phantomjs and chrome.

Also this.$().blur(); or this.$().focusout(); both phantomjs and chrome don't seem to work.

+7
jquery phantomjs ember-testing ember-components
source share
1 answer

try with trigger instead, this worked for me

  this.$('input').focusout(); this.$('input').blur(); this.$('input').trigger('focusout'); this.$('input').trigger('blur'); this.$('input').trigger('keyup'); // another event that you can trigger 

Additional Information

+1
source share

All Articles