aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLucas Galfasó2013-08-12 10:53:31 -0300
committerBrian Ford2013-10-02 11:10:29 -0700
commit10cc1a42c925749f88433546d41d35ba07a88e6f (patch)
tree6af4ceeb959dd8275fbc2e3efb766b016767c306 /test
parent40414827f42c8fb86abb835f7387d5b02923d532 (diff)
downloadangular.js-10cc1a42c925749f88433546d41d35ba07a88e6f.tar.bz2
fix($scope): $evalAsync executes on the right scope
Executes $evalAsync at the scope that the call was made Closes: #3548
Diffstat (limited to 'test')
-rw-r--r--test/ng/rootScopeSpec.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js
index a23db81a..e8bf8eed 100644
--- a/test/ng/rootScopeSpec.js
+++ b/test/ng/rootScopeSpec.js
@@ -766,6 +766,17 @@ describe('Scope', function() {
expect($rootScope.log).toBe('12');
}));
+ it('should run async expressions in their proper context', inject(function ($rootScope) {
+ var child = $rootScope.$new();
+ $rootScope.ctx = 'root context';
+ $rootScope.log = '';
+ child.ctx = 'child context';
+ child.log = '';
+ child.$evalAsync('log=ctx');
+ $rootScope.$digest();
+ expect($rootScope.log).toBe('');
+ expect(child.log).toBe('child context');
+ }));
it('should operate only with a single queue across all child and isolate scopes', inject(function($rootScope) {
var childScope = $rootScope.$new();
@@ -777,7 +788,10 @@ describe('Scope', function() {
expect(childScope.$$asyncQueue).toBe($rootScope.$$asyncQueue);
expect(isolateScope.$$asyncQueue).toBe($rootScope.$$asyncQueue);
- expect($rootScope.$$asyncQueue).toEqual(['rootExpression', 'childExpression', 'isolateExpression']);
+ expect($rootScope.$$asyncQueue).toEqual([
+ {scope: $rootScope, expression: 'rootExpression'},
+ {scope: childScope, expression: 'childExpression'},
+ {scope: isolateScope, expression: 'isolateExpression'}]);
}));