Reputation: 7551
How do you trigger selecting an <option>
in a select
element in an integration test? select2 is simple enough: Simulate a ember-select2 selection in ember integration test
Upvotes: 6
Views: 4101
Reputation: 22933
I've had to do this for the underlying event code to be triggered (Ember 2.16):
find('select#my-select').val('foo').trigger('change');
Upvotes: 1
Reputation: 27407
A basic example for ember 1.12 or 1.13+ would use the fillIn helper. I just haven't used it with a jquery select like the one you mention above. Give this a try and report back :)
visit("/foobar");
var firstOption = find(".my-select option:eq(0)");
fillIn(".my-select", firstOption.val());
andThen(function() {
assert.equal(find(".my-select").val(), 78); //assuming 78 is the first options value ...
});
Upvotes: 7