Skip to content

Instantly share code, notes, and snippets.

@mars
Last active December 20, 2015 06:29
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mars/6086194 to your computer and use it in GitHub Desktop.
Save mars/6086194 to your computer and use it in GitHub Desktop.
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
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
Copy link

givanse commented Feb 15, 2015

@toranb thanks :)

@bargar
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 :)

@RobbieTheWagner
Copy link

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

@keithbro
Copy link

@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