Skip to content

Instantly share code, notes, and snippets.

@mars mars/gist:6086194
Last active Dec 20, 2015

Embed
What would you like to do?
DEPRECATED see comments: ember-testing: select an option (helper)
Ember.Test.registerHelper('selectFrom',
function(app, selector, value, description) {
// choose an option
find(selector).val(value);
// trigger the change
find(selector).change();
// assert the selected option
equal(find(selector+" option:selected").val(), value, description||"makes the selection");
// promise
return wait();
}
);
@toranb

This comment has been minimized.

Copy link

toranb commented Oct 9, 2014

Just a quick heads up - in the latest ember build (1.7 for example) you can use the fillIn helper to do this very thing :)

@givanse

This comment has been minimized.

Copy link

givanse commented Feb 15, 2015

@toranb thanks :)

@bargar

This comment has been minimized.

Copy link

bargar commented Jun 15, 2015

@toranb seconded. Slightly counterintuitive that fillIn works with fields that are selected rather than filled in, but the important thing is it's useful and works :)

@rwwagner90

This comment has been minimized.

Copy link

rwwagner90 commented Jun 17, 2015

So, how do we use fillIn to test the select view? I can't get it to work.

@keithbro

This comment has been minimized.

Copy link

keithbro commented Jun 18, 2015

@rwwagner90 I just tried it on Ember 1.11.1 and it works fine

fillIn(selector, value);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.