在ember集成测试中模拟ember-select2选项 [英] Simulate a ember-select2 selection in ember integration test
本文介绍了在ember集成测试中模拟ember-select2选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
到目前为止我已经尝试过:
test(检查导航,function(){
expect(1);
visit(/ hub);
click(#btnLogin);
andThen(function(){
click容器);
和Then(function(){
});
});
});
但我没有看到UI中的更改。
解决方案
我们需要点击集装箱内的锚点
Ember。$ (.select2-container a)。trigger({type:'mousedown',which:1});
如果要在下拉列表中选择一个项目,可以执行以下操作:
Ember。$(。select2-results li div)。trigger({type:'mouseup',which:1});
Has anyone been able to simulate a select2 selection of an option? So far I've tried this:
test("Checking navigation", function () {
expect(1);
visit("/hub");
click("#btnLogin");
andThen(function () {
click(".select2-container");
andThen(function () {
});
});
});
But I have not seen changes in the UI.
解决方案
We need to hit the anchor inside the container
Ember.$(" .select2-container a").trigger({type:'mousedown', which:1});
If you want to select an item in the dropdown you can do:
Ember.$(".select2-results li div").trigger({type:'mouseup', which:1});
这篇关于在ember集成测试中模拟ember-select2选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文