feat(e2eRunner): fail when an option to select does not exist

This commit is contained in:
Stephane Bisson 2012-11-14 12:33:54 +08:00 committed by Pawel Kozlowski
parent 2c405f4171
commit 15183f3e1f
2 changed files with 13 additions and 0 deletions

View file

@ -298,6 +298,8 @@ angular.scenario.dsl('select', function() {
option = select.find('option:contains("' + value + '")');
if (option.length) {
select.val(option.val());
} else {
return done("option '" + value + "' not found");
}
}
select.trigger('change');

View file

@ -269,6 +269,17 @@ describe("angular.scenario.dsl", function() {
$root.dsl.select('test').options('A', 'B');
expect($root.futureError).toMatch(/did not match/);
});
it('should fail to select an option that does not exist', function(){
doc.append(
'<select ng-model="test">' +
' <option value=A>one</option>' +
' <option value=B selected>two</option>' +
'</select>'
);
$root.dsl.select('test').option('three');
expect($root.futureError).toMatch(/not found/);
});
});
describe('Element', function() {