karma tests with $interval

Using $interval instead of the JavaScript native setInteval gives you more control in your tests. $interval works synchronously and will wait until you feed it with time offsets, using

$interval.flush(<msecs>)