如何在Ember.js验收测试中触发“输入”字段的“换行”动作? [英] How to trigger an `input` field's `newline` action in an Ember.js acceptance test?

查看:85
本文介绍了如何在Ember.js验收测试中触发“输入”字段的“换行”动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为 keyEvent('。my input','keypress',13); 会触发输入的换行符动作,但似乎没有。

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

似乎其他人有类似的问题

是否还有其他/更好的触发方式我的验收测试中的换行操作?

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

推荐答案

就像触发键盘按下然后使用 keyup 事件(而不是 keypress )来达到目的:

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);

这篇关于如何在Ember.js验收测试中触发“输入”字段的“换行”动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆