Skip to content

Commit

Permalink
test(carousel): check timers on scope destruction
Browse files Browse the repository at this point in the history
Reproduce angular-ui#1414
  • Loading branch information
chrisirhc committed Dec 23, 2013
1 parent db73cb3 commit f63a125
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/carousel/test/carousel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,20 @@ describe('carousel', function() {
expect(ctrl.slides.length).toBe(1);
expect(ctrl.currentSlide).toBe(ctrl.slides[0]);
});

it('issue 1414 - should not continue running timers after scope is destroyed', function() {
spyOn(scope, 'next').andCallThrough();
scope.interval = 2000;
scope.$digest();

$timeout.flush();
expect(scope.next.calls.length).toBe(1);

scope.$destroy();

$timeout.flush(scope.interval);
expect(scope.next.calls.length).toBe(1);
});
});
});
});

0 comments on commit f63a125

Please sign in to comment.