I am trying to test the following component's controller lookup function:
lookup () {
this.current = this.$interval(() => {
console.log("this.currentIndex");
if (this.index == 1) {
this.currentIndex = this.index;
}
});
This is how I am trying to test it:
beforeEach(inject(function($rootScope, $componentController, _$httpBackend_, _$interval_) {
$httpBackend = _$httpBackend_;
$interval = _$interval_;
scope = $rootScope.$new();
controller = $componentController('control', {
$scope : scope
});
it('test',function(done) {
controller.lookup();
//TRIED USING $interval.flush(0) but doesn't help
});
The issue is it is never executing that $interval function..ie. never prints that console.log(this.currentIndex) and not even throwing any errors.
Thanks for any help.
Aucun commentaire:
Enregistrer un commentaire