Skip to content

Instantly share code, notes, and snippets.

@ck1125
Created June 27, 2013 14:25
Show Gist options
  • Save ck1125/5876845 to your computer and use it in GitHub Desktop.
Save ck1125/5876845 to your computer and use it in GitHub Desktop.
Select box get options Angular Scenario DSL
angular.scenario.dsl('selectBox', function() {
var chain = {};
chain.options = function() {
return this.addFutureAction("select options'" + this.name, function($window, $document, done) {
var select = $document.elements(this.name);
var option = select.find('option'), items = [];
for(var i = 0; i < option.length; i++) {
items.push(option[i].text);
}
done(null,items);
});
};
return function(name) {
this.name = name;
return chain;
};
});
@ck1125
Copy link
Author

ck1125 commented Jun 27, 2013

To use:

expect(selectBox("select[name='blah']").options()).toEqual([option 1','option 2']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment