fix(ngMock): return false from mock $interval.cancel() when no argument is supplied

Closes #6103.
Closed #6099.
This commit is contained in:
Daniel Luxemburg 2014-02-03 20:04:46 -05:00 committed by Tobias Bosch
parent 36d37c0e38
commit dd24c78373
2 changed files with 6 additions and 0 deletions

View file

@ -504,6 +504,7 @@ angular.mock.$IntervalProvider = function() {
};
$interval.cancel = function(promise) {
if(!promise) return false;
var fnIndex;
angular.forEach(repeatFns, function(fn, index) {

View file

@ -509,6 +509,11 @@ describe('ngMock', function() {
it('should not throw a runtime exception when given an undefined promise',
inject(function($interval) {
var task1 = jasmine.createSpy('task1'),
promise1;
promise1 = $interval(task1, 1000, 1);
expect($interval.cancel()).toBe(false);
}));
});