Skip to content

Commit f63a125

Browse files
committed
test(carousel): check timers on scope destruction
Reproduce angular-ui#1414
1 parent db73cb3 commit f63a125

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: src/carousel/test/carousel.spec.js

+14
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,20 @@ describe('carousel', function() {
294294
expect(ctrl.slides.length).toBe(1);
295295
expect(ctrl.currentSlide).toBe(ctrl.slides[0]);
296296
});
297+
298+
it('issue 1414 - should not continue running timers after scope is destroyed', function() {
299+
spyOn(scope, 'next').andCallThrough();
300+
scope.interval = 2000;
301+
scope.$digest();
302+
303+
$timeout.flush();
304+
expect(scope.next.calls.length).toBe(1);
305+
306+
scope.$destroy();
307+
308+
$timeout.flush(scope.interval);
309+
expect(scope.next.calls.length).toBe(1);
310+
});
297311
});
298312
});
299313
});

0 commit comments

Comments
 (0)