From 1c9fc1e1dec67c8c05f02da1e0853439238c4d8e Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 11 Aug 2011 15:02:08 -0700 Subject: fix(scope): rerun $digest from root, rather then per scope. --- test/ScopeSpec.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index a2ad57a3..6105df21 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -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++;}); -- cgit v1.2.3