File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,8 @@ angular.scenario.dsl('select', function() {
298
298
option = select . find ( 'option:contains("' + value + '")' ) ;
299
299
if ( option . length ) {
300
300
select . val ( option . val ( ) ) ;
301
+ } else {
302
+ return done ( "option '" + value + "' not found" ) ;
301
303
}
302
304
}
303
305
select . trigger ( 'change' ) ;
Original file line number Diff line number Diff line change @@ -269,6 +269,17 @@ describe("angular.scenario.dsl", function() {
269
269
$root . dsl . select ( 'test' ) . options ( 'A' , 'B' ) ;
270
270
expect ( $root . futureError ) . toMatch ( / d i d n o t m a t c h / ) ;
271
271
} ) ;
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 ( / n o t f o u n d / ) ;
282
+ } ) ;
272
283
} ) ;
273
284
274
285
describe ( 'Element' , function ( ) {
You can’t perform that action at this time.
0 commit comments