Simulate ember-select2 selection in ember integration test

Has anyone been able to simulate a select2 selection by choice? So far I have tried this:

 test("Checking navigation", function () {
      expect(1);
      visit("/hub");
      click("#btnLogin");
      andThen(function () {
        click(".select2-container");
        andThen(function () {
        });
      });
    });

      

But I haven't seen any changes in the user interface.

+1


source to share


2 answers


We need to click on the anchor inside the container

  Ember.$(" .select2-container a").trigger({type:'mousedown', which:1});

      



If you want to select an item in the dropdown menu, you can do:

Ember.$(".select2-results li div").trigger({type:'mouseup', which:1});

      

+4


source


After playing some games I think this is what you are looking for:



find(".select2-container:first").trigger({type:'mousedown', which:1});

      

+1


source







All Articles