mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix(scope): rerun $digest from root, rather then per scope.
This commit is contained in:
@@ -178,6 +178,15 @@ describe('Scope', function(){
|
||||
expect(log).toEqual('abc');
|
||||
});
|
||||
|
||||
it('should repeat watch cycle from the root elemnt', function(){
|
||||
var log = '';
|
||||
var child = root.$new();
|
||||
root.$watch(function(){ log += 'a'; });
|
||||
child.$watch(function(){ log += 'b'; });
|
||||
root.$digest();
|
||||
expect(log).toEqual('abab');
|
||||
});
|
||||
|
||||
|
||||
it('should prevent infinite recursion', function(){
|
||||
root.$watch('a', function(self, v){self.b++;});
|
||||
|
||||
Reference in New Issue
Block a user