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
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 ...
});
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');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With