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

Commit 15183f3

Browse files
feat(e2eRunner): fail when an option to select does not exist
1 parent 2c405f4 commit 15183f3

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/ngScenario/dsl.js

+2
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,8 @@ angular.scenario.dsl('select', function() {
298298
option = select.find('option:contains("' + value + '")');
299299
if (option.length) {
300300
select.val(option.val());
301+
} else {
302+
return done("option '" + value + "' not found");
301303
}
302304
}
303305
select.trigger('change');

test/ngScenario/dslSpec.js

+11
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,17 @@ describe("angular.scenario.dsl", function() {
269269
$root.dsl.select('test').options('A', 'B');
270270
expect($root.futureError).toMatch(/did not match/);
271271
});
272+
273+
it('should fail to select an option that does not exist', function(){
274+
doc.append(
275+
'<select ng-model="test">' +
276+
' <option value=A>one</option>' +
277+
' <option value=B selected>two</option>' +
278+
'</select>'
279+
);
280+
$root.dsl.select('test').option('three');
281+
expect($root.futureError).toMatch(/not found/);
282+
});
272283
});
273284

274285
describe('Element', function() {

0 commit comments

Comments
 (0)