angular/angular.js — pull request #6103 by dluxemburg (2014-02-04 01:24:43+00:00)
Title: fix(ngMock): return immediately from mock $interval.cancel() when no promise argument is supplied

This is a fix for a possible cause of issue #6099.

Calling `$interval.cancel()` without supplying the expected argument would cause a TypeError. There was a test for this but it was incomplete because it did not setup the instance of $interval with any repeated functions, so the function passed to `forEach` in which the error is thrown is never executed. The test failed when a repeated task was added.

This pull requests prevents the runtime exception by returning from `cancel()` immediately if no promise is supplied (doesn't even get to the loop) and improves the test by setting up a repeating task as the other tests do.