This repository was archived by the owner on Oct 2, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 431431 ctrl . selected = item ;
432432 }
433433
434- ctrl . onSelectCallback ( $scope , {
434+ $timeout ( function ( ) {
435+ ctrl . onSelectCallback ( $scope , {
435436 $item : item ,
436437 $model : ctrl . parserResult . modelMapper ( $scope , locals )
438+ } ) ;
437439 } ) ;
438440
439441 if ( ! ctrl . multiple || ctrl . closeOnSelect ) {
495497 ctrl . activeMatchIndex = - 1 ;
496498 ctrl . sizeSearchInput ( ) ;
497499
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+ } ) ;
501506 } ) ;
502507 } ;
503508
Original file line number Diff line number Diff line change @@ -774,6 +774,9 @@ describe('ui-select tests', function() {
774774 expect ( scope . $model ) . toBeFalsy ( ) ;
775775
776776 clickItem ( el , 'Samantha' ) ;
777+ $timeout . flush ( ) ;
778+
779+
777780 expect ( scope . selection . selected ) . toBe ( 'Samantha' ) ;
778781
779782 expect ( scope . $item ) . toEqual ( scope . people [ 5 ] ) ;
@@ -858,6 +861,7 @@ describe('ui-select tests', function() {
858861 clickItem ( el , 'Samantha' ) ;
859862 clickItem ( el , 'Adrian' ) ;
860863 el . find ( '.ui-select-match-item' ) . first ( ) . find ( '.ui-select-match-close' ) . click ( ) ;
864+ $timeout . flush ( ) ;
861865
862866 expect ( scope . $item ) . toBe ( scope . people [ 5 ] ) ;
863867 expect ( scope . $model ) . toBe ( 'Samantha' ) ;
@@ -887,6 +891,7 @@ describe('ui-select tests', function() {
887891 clickItem ( el , 'Samantha' ) ;
888892 clickItem ( el , 'Adrian' ) ;
889893 el . find ( '.ui-select-match-item' ) . first ( ) . find ( '.ui-select-match-close' ) . click ( ) ;
894+ $timeout . flush ( ) ;
890895
891896 expect ( scope . $item ) . toBe ( scope . people [ 5 ] ) ;
892897 expect ( scope . $model ) . toBe ( scope . $item ) ;
You can’t perform that action at this time.
0 commit comments