How to trigger an `input` field's `newline` action in an Ember.js acceptance test?

时间秒杀一切 提交于 2019-12-11 13:44:19

问题


I had thought that keyEvent('.my input', 'keypress', 13); would trigger the input's newline action, but it doesn't seem to.

It seems others have had a similar problem

Is there any other/better way to trigger the newline action from my acceptance test?


回答1:


Looks like triggering a keydown then a keyup event (instead of a keypress) does the trick:

keyEvent('.my input', 'keydown', 13);
keyEvent('.my input', 'keyup', 13);


来源:https://stackoverflow.com/questions/37868688/how-to-trigger-an-input-fields-newline-action-in-an-ember-js-acceptance-tes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!