javascript - $q doesn't remove pending tasks in angular -


if create test angular use $q mock or create promise defer task created.

i thought calling $rootscope.$apply should resolve these promises.

but if call $timeout.verifynopendingtasks() exception thrown because

error: deferred tasks flush (1): {id: 0, time: 0}

why , how fix ?

 it.only('should work', function () {         var spy = sinon.spy();         $q.when().then(spy);         $rootscope.$apply();         spy.should.have.been.called;          $timeout.verifynopendingtasks();     }); 


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -