mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-13 22:39:59 +08:00
fix(Scope): ensure that a scope is destroyed only once
Due to bd524fc4 calling $destroy() on a scope mupltiple times cases NPE.
Closes #1627
This commit is contained in:
@@ -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');
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user