aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgor Minar2012-11-30 01:16:08 +0100
committerIgor Minar2012-11-30 13:10:00 +0100
commitd6da505f4e044f8a487ac27a3ec707c11853ee0a (patch)
tree039b8e1fd3cb1ba201d780d85e0a9ff985a35925 /test
parent5f7054bf5d1189c9a7842bc6e6f97c003514fcd5 (diff)
downloadangular.js-d6da505f4e044f8a487ac27a3ec707c11853ee0a.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.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ng/rootScopeSpec.js b/test/ng/rootScopeSpec.js
index ee7fb796..55fc41b1 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');
+ }));
});