Simulate a ember-select2 selection in ember integr

2019-08-03 15:35发布

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.

2条回答
倾城 Initia
2楼-- · 2019-08-03 15:54

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});
查看更多
神经病院院长
3楼-- · 2019-08-03 16:00

After some playing around, I think this is what you're looking for:

find(".select2-container:first").trigger({type:'mousedown', which:1});
查看更多
登录 后发表回答