yka*_*gol 7 jquery phantomjs ember.js ember-testing ember-components
如何在测试Ember.js组件时触发焦点和模糊事件?
this.$().focus();或this.$('input').focus();似乎工作但在phantomjs和chrome中表现不同.
也this.$().blur();或this.$().focusout();似乎没有工作phantomjs和铬.
新版本的 Ember 有测试助手,可用于聚焦或模糊。
...
import { find, focus, blur, render } from '@ember/test-helpers';
module('Integration | Component | example-input', function(hooks) {
test('it can be focused', async function(assert) {
await render(hbs`<myInput />`);
const input = find('input')
await focus(input)
await blur(input)
});
});
Run Code Online (Sandbox Code Playgroud)
模糊:https://github.com/emberjs/ember-test-helpers/blob/master/API.md#blur
焦点:https ://github.com/emberjs/ember-test-helpers/blob/master/API.md#focus
| 归档时间: |
|
| 查看次数: |
944 次 |
| 最近记录: |