aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/rootScopeSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2012-05-23 14:49:01 -0700
committerMisko Hevery2012-05-23 16:01:20 -0700
commit989446eceee697b15ecb5df1f491dfbcff352256 (patch)
treed9b22e53d9014924019f17c9fe3b2b5d85838592 /test/ng/rootScopeSpec.js
parent5214c1d0cbd8473e1f5dd3894f1fcbecd89bc8af (diff)
downloadangular.js-989446eceee697b15ecb5df1f491dfbcff352256.tar.bz2
fix($rootScope): TTL exception does not clear $$phase
When $digest() throws infinite digest exception it does not properly clear the $phase leaving the scope in an inconsistent state. Closes #979
Diffstat (limited to 'test/ng/rootScopeSpec.js')
-rw-r--r--test/ng/rootScopeSpec.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js
index 9d343b08..934541c1 100644
--- a/test/ng/rootScopeSpec.js
+++ b/test/ng/rootScopeSpec.js
@@ -210,6 +210,8 @@ describe('Scope', function() {
'["a; newVal: 98; oldVal: 97","b; newVal: 99; oldVal: 98"],' +
'["a; newVal: 99; oldVal: 98","b; newVal: 100; oldVal: 99"],' +
'["a; newVal: 100; oldVal: 99","b; newVal: 101; oldVal: 100"]]');
+
+ expect($rootScope.$$phase).toBeNull();
});
});
@@ -492,6 +494,27 @@ describe('Scope', function() {
});
+ it('should log exceptions from $digest', function() {
+ module(function($rootScopeProvider, $exceptionHandlerProvider) {
+ $rootScopeProvider.digestTtl(2);
+ $exceptionHandlerProvider.mode('log');
+ });
+ inject(function($rootScope, $exceptionHandler) {
+ $rootScope.$watch('a', function() {$rootScope.b++;});
+ $rootScope.$watch('b', function() {$rootScope.a++;});
+ $rootScope.a = $rootScope.b = 0;
+
+ expect(function() {
+ $rootScope.$apply();
+ }).toThrow();
+
+ expect($exceptionHandler.errors[0]).toBeDefined();
+
+ expect($rootScope.$$phase).toBeNull();
+ });
+ });
+
+
describe('exceptions', function() {
var log;
beforeEach(module(function($exceptionHandlerProvider) {