diff options
| author | Igor Minar | 2012-11-30 01:16:08 +0100 |
|---|---|---|
| committer | Igor Minar | 2012-11-30 13:09:50 +0100 |
| commit | e7ba83069117b4ed6ebf383c30c73224632d569a (patch) | |
| tree | 9f7cce95d92c04e0be773cdc9d9b148dbf78e2c4 /test | |
| parent | 4eb0716711e616949e8f45ef71b166989246eb9c (diff) | |
| download | angular.js-e7ba83069117b4ed6ebf383c30c73224632d569a.tar.bz2 | |
fix(Scope): ensure that a scope is destroyed only once
Due to bd524fc4 calling $destroy() on a scope mupltiple times cases NPE.
Closes #1627
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/rootScopeSpec.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js index 5bdf4774..3f6f795a 100644 --- a/test/ng/rootScopeSpec.js +++ b/test/ng/rootScopeSpec.js @@ -407,6 +407,22 @@ describe('Scope', function() { first.$destroy(); expect(log).toEqual('first; first-child'); })); + + + it('should $destroy a scope only once and ignore any further destroy calls', + inject(function($rootScope) { + $rootScope.$digest(); + expect(log).toBe('123'); + + first.$destroy(); + first.$apply(); + expect(log).toBe('12323'); + + first.$destroy(); + first.$destroy(); + first.$apply(); + expect(log).toBe('1232323'); + })); }); |
