@@ -766,6 +766,17 @@ describe('Scope', function() {
766
766
expect ( $rootScope . log ) . toBe ( '12' ) ;
767
767
} ) ) ;
768
768
769
+ it ( 'should run async expressions in their proper context' , inject ( function ( $rootScope ) {
770
+ var child = $rootScope . $new ( ) ;
771
+ $rootScope . ctx = 'root context' ;
772
+ $rootScope . log = '' ;
773
+ child . ctx = 'child context' ;
774
+ child . log = '' ;
775
+ child . $evalAsync ( 'log=ctx' ) ;
776
+ $rootScope . $digest ( ) ;
777
+ expect ( $rootScope . log ) . toBe ( '' ) ;
778
+ expect ( child . log ) . toBe ( 'child context' ) ;
779
+ } ) ) ;
769
780
770
781
it ( 'should operate only with a single queue across all child and isolate scopes' , inject ( function ( $rootScope ) {
771
782
var childScope = $rootScope . $new ( ) ;
@@ -777,7 +788,10 @@ describe('Scope', function() {
777
788
778
789
expect ( childScope . $$asyncQueue ) . toBe ( $rootScope . $$asyncQueue ) ;
779
790
expect ( isolateScope . $$asyncQueue ) . toBe ( $rootScope . $$asyncQueue ) ;
780
- expect ( $rootScope . $$asyncQueue ) . toEqual ( [ 'rootExpression' , 'childExpression' , 'isolateExpression' ] ) ;
791
+ expect ( $rootScope . $$asyncQueue ) . toEqual ( [
792
+ { scope : $rootScope , expression : 'rootExpression' } ,
793
+ { scope : childScope , expression : 'childExpression' } ,
794
+ { scope : isolateScope , expression : 'isolateExpression' } ] ) ;
781
795
} ) ) ;
782
796
783
797
0 commit comments