Thank you, I'd never think of that! You have saved me a lot of time.

W dniu wtorek, 19 marca 2013 18:32:08 UTC+1 użytkownik Christian Dannie 
Storgaard napisał:
>
> I believe the trick is to return null from the module ($provide) function 
> - as it seems you've discovered as well ;)
>
> So, for others stumbling on to this thread, this won't work:
>
> module ($provide) ->
>       $provide.value '$window', mock
>       $provide.value '$q', q
>
>
> this will:
>
> module ($provide) ->
>       $provide.value '$window', mock
>       $provide.value '$q', q
>       null
>
>
> On Wednesday, 20 February 2013 13:00:16 UTC+2, Mike Spainhower wrote:
>>
>> Is the documentation at 
>> http://docs.angularjs.org/guide/dev_guide.services.testing_servicesstill 
>> valid?  I am trying to mock $window in the same fashion for a 
>> service's unit test, but get the following error when 
>> $provide.value('$window', mock) is present
>>
>> Error: Argument 'fn' is not a function, got Object
>>             at assertArg 
>> (/home/spainhower/apps/frontend/angular-piwik/vendor/angular.js:975)
>>             at assertArgFn 
>> (/home/spainhower/apps/frontend/angular-piwik/vendor/angular.js:986)
>>             at annotate 
>> (/home/spainhower/apps/frontend/angular-piwik/vendor/angular.js:2306)
>>             at invoke 
>> (/home/spainhower/apps/frontend/angular-piwik/vendor/angular.js:2789)
>>             at 
>> /home/spainhower/apps/frontend/angular-piwik/vendor/angular.js:2662
>>
>> Test code here: 
>> https://github.com/mike-spainhower/angular-piwik/blob/master/test/servicesSpec.coffee
>> Service code here: 
>> https://github.com/mike-spainhower/angular-piwik/blob/master/lib/angular-piwik.coffee
>>
>> Thanks!
>>
>

-- 
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/groups/opt_out.

Reply via email to