File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,22 @@ describe('select', function() {
428
428
expect ( select . val ( ) ) . toEqual ( '0' ) ;
429
429
expect ( select . find ( 'option' ) . length ) . toEqual ( 1 ) ;
430
430
} ) ;
431
+
432
+ it ( 'should select correct input if previously bound to something not in the list' , function ( ) {
433
+ createSingleSelect ( ) ;
434
+ scope . values = [ { name :'A' } , { name :'B' } ] ;
435
+ scope . selected = { } ;
436
+ scope . $digest ( ) ;
437
+ expect ( select . find ( 'option' ) . length ) . toEqual ( 3 ) ;
438
+ expect ( select . val ( ) ) . toEqual ( '?' ) ;
439
+ expect ( jqLite ( select . find ( 'option' ) [ 0 ] ) . val ( ) ) . toEqual ( '?' ) ;
440
+
441
+ select . find ( 'option' ) . eq ( 1 ) . prop ( 'selected' , true ) ;
442
+ browserTrigger ( select , 'change' ) ;
443
+ expect ( select . val ( ) ) . toEqual ( '0' ) ;
444
+ expect ( select . find ( 'option' ) . eq ( 0 ) . prop ( 'selected' ) ) . toBeTruthy ( ) ;
445
+ expect ( select . find ( 'option' ) . length ) . toEqual ( 2 ) ;
446
+ } ) ;
431
447
} ) ;
432
448
433
449
describe ( 'on change' , function ( ) {
You can’t perform that action at this time.
0 commit comments