Hey, did you found out, what the problem was? I stuck at the same problem.
Would be nice to hear from you.
Regards,
Max
Am Sonntag, 15. Juni 2014 13:55:51 UTC+2 schrieb Jurek Błaszczyk:
>
> I use *$q.when* to wrap around other lib promises.
> It works like a charm but when i try to run it inside Karma the promise
> failes to resolve (*done()* is never executed) even if I ran $digest and
> even after timeout.
>
> Here is sample code:
>
> describe('test', function () {
> var $scope, $db, $q, $rootScope;
>
> beforeEach(inject(function ($compile, _$rootScope_, _$q_, Database) {
> $rootScope = _$rootScope_;
> $scope = _$rootScope_.$new();
> $q = _$q_;
> }));
>
> it("should run", function (done) {
>
> function getPromise() {
> var deferred = Q.defer();
> deferred.resolve(1);
> return deferred.promise;
> }
>
> $q.when(getPromise())
> .then(function () {
> done(); // this never runs
> });
>
> $rootScope.$digest();
> });
>
> When I change Q for $q inside getPromise(), everything is ok. Why? What is
> the cause of this? I really cannot get it.
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.