This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree 2 files changed +14
-4
lines changed 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 431
431
ctrl . selected = item ;
432
432
}
433
433
434
- ctrl . onSelectCallback ( $scope , {
434
+ $timeout ( function ( ) {
435
+ ctrl . onSelectCallback ( $scope , {
435
436
$item : item ,
436
437
$model : ctrl . parserResult . modelMapper ( $scope , locals )
438
+ } ) ;
437
439
} ) ;
438
440
439
441
if ( ! ctrl . multiple || ctrl . closeOnSelect ) {
495
497
ctrl . activeMatchIndex = - 1 ;
496
498
ctrl . sizeSearchInput ( ) ;
497
499
498
- ctrl . onRemoveCallback ( $scope , {
499
- $item : removedChoice ,
500
- $model : ctrl . parserResult . modelMapper ( $scope , locals )
500
+ // Give some time for scope propagation.
501
+ $timeout ( function ( ) {
502
+ ctrl . onRemoveCallback ( $scope , {
503
+ $item : removedChoice ,
504
+ $model : ctrl . parserResult . modelMapper ( $scope , locals )
505
+ } ) ;
501
506
} ) ;
502
507
} ;
503
508
Original file line number Diff line number Diff line change @@ -774,6 +774,9 @@ describe('ui-select tests', function() {
774
774
expect ( scope . $model ) . toBeFalsy ( ) ;
775
775
776
776
clickItem ( el , 'Samantha' ) ;
777
+ $timeout . flush ( ) ;
778
+
779
+
777
780
expect ( scope . selection . selected ) . toBe ( 'Samantha' ) ;
778
781
779
782
expect ( scope . $item ) . toEqual ( scope . people [ 5 ] ) ;
@@ -858,6 +861,7 @@ describe('ui-select tests', function() {
858
861
clickItem ( el , 'Samantha' ) ;
859
862
clickItem ( el , 'Adrian' ) ;
860
863
el . find ( '.ui-select-match-item' ) . first ( ) . find ( '.ui-select-match-close' ) . click ( ) ;
864
+ $timeout . flush ( ) ;
861
865
862
866
expect ( scope . $item ) . toBe ( scope . people [ 5 ] ) ;
863
867
expect ( scope . $model ) . toBe ( 'Samantha' ) ;
@@ -887,6 +891,7 @@ describe('ui-select tests', function() {
887
891
clickItem ( el , 'Samantha' ) ;
888
892
clickItem ( el , 'Adrian' ) ;
889
893
el . find ( '.ui-select-match-item' ) . first ( ) . find ( '.ui-select-match-close' ) . click ( ) ;
894
+ $timeout . flush ( ) ;
890
895
891
896
expect ( scope . $item ) . toBe ( scope . people [ 5 ] ) ;
892
897
expect ( scope . $model ) . toBe ( scope . $item ) ;
You can’t perform that action at this time.
0 commit comments