diff options
| author | Thomas Guillory | 2013-11-06 15:01:10 +0100 | 
|---|---|---|
| committer | Jeff Cross | 2013-12-04 10:11:29 -0800 | 
| commit | d3c486dd6dfa8d5dca32a3e28aa685fb7260c878 (patch) | |
| tree | 6124ee32d9c1adaacc0060a99c025810aeda3871 /test/ng/rootScopeSpec.js | |
| parent | 2d0f6ccba896fe34141d6d4f59eef6fba580c5c2 (diff) | |
| download | angular.js-d3c486dd6dfa8d5dca32a3e28aa685fb7260c878.tar.bz2 | |
fix($rootScope): clear phase if an exception is raised by a watcher
Add calls to clearPhase() when an exception is raised by a watcher
while a digest cycle, in order to not be stuck on `$digest` scope phase
Diffstat (limited to 'test/ng/rootScopeSpec.js')
| -rw-r--r-- | test/ng/rootScopeSpec.js | 9 | 
1 files changed, 9 insertions, 0 deletions
| diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js index 894c26d2..69447a3c 100644 --- a/test/ng/rootScopeSpec.js +++ b/test/ng/rootScopeSpec.js @@ -127,6 +127,15 @@ describe('Scope', function() {        });      }); +    it('should clear phase if an exception interrupt $digest cycle', function() { +      inject(function($rootScope) { +        $rootScope.$watch('a', function() {throw new Error('abc');}); +        $rootScope.a = 1; +        try { $rootScope.$digest(); } catch(e) { } +        expect($rootScope.$$phase).toBeNull(); +      }); +    }); +      it('should fire watches in order of addition', inject(function($rootScope) {        // this is not an external guarantee, just our own sanity | 
