Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
feat(e2eRunner): fail when an option to select does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebisson authored and pkozlowski-opensource committed Dec 1, 2012
1 parent 2c405f4 commit 15183f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ngScenario/dsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
11 changes: 11 additions & 0 deletions test/ngScenario/dslSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 15183f3

Please sign in to comment.