mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-10 15:54:42 +00:00
fix(Scope): ensure that isolate scopes use the main evalAsync queue
Previously any $evalAsync task scheduled from a isolate scope or a child of an isolate scope would never execute because we never flushed this queue
This commit is contained in:
parent
e14e21904a
commit
3967f5f7d6
2 changed files with 15 additions and 0 deletions
|
|
@ -165,6 +165,8 @@ function $RootScopeProvider(){
|
||||||
if (isolate) {
|
if (isolate) {
|
||||||
child = new Scope();
|
child = new Scope();
|
||||||
child.$root = this.$root;
|
child.$root = this.$root;
|
||||||
|
// ensure that there is just one async queue per $rootScope and it's children
|
||||||
|
child.$$asyncQueue = this.$$asyncQueue;
|
||||||
} else {
|
} else {
|
||||||
Child = function() {}; // should be anonymous; This is so that when the minifier munges
|
Child = function() {}; // should be anonymous; This is so that when the minifier munges
|
||||||
// the name it does not become random set of chars. These will then show up as class
|
// the name it does not become random set of chars. These will then show up as class
|
||||||
|
|
|
||||||
|
|
@ -692,6 +692,19 @@ describe('Scope', function() {
|
||||||
expect($rootScope.log).toBe('12');
|
expect($rootScope.log).toBe('12');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('should operate only with a single queue across all child and isolate scopes', inject(function($rootScope) {
|
||||||
|
var childScope = $rootScope.$new();
|
||||||
|
var isolateScope = $rootScope.$new(true);
|
||||||
|
|
||||||
|
$rootScope.$evalAsync('rootExpression');
|
||||||
|
childScope.$evalAsync('childExpression');
|
||||||
|
isolateScope.$evalAsync('isolateExpression');
|
||||||
|
|
||||||
|
expect(childScope.$$asyncQueue).toBe($rootScope.$$asyncQueue);
|
||||||
|
expect(isolateScope.$$asyncQueue).toBe($rootScope.$$asyncQueue);
|
||||||
|
expect($rootScope.$$asyncQueue).toEqual(['rootExpression', 'childExpression', 'isolateExpression']);
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue