.andCallThrough is a function. You need to call it, like so: spyOn(scope, 
'arithmetic').andCallThrough()

On Friday, January 31, 2014 10:48:13 PM UTC-8, Varun Krishna Parthasarathy 
wrote:
>
> Hi,
> I want to check whether a function is called when  a button is clicked.  I 
> have used spyOn(obj, 'method').andCallThrough but it did not work. 
>
> *<!--- my template.html -- >*
>
> *<html>*
>
> *.....*
>
> *.....*
>
> *....*
>
> *....*
>
> *<button btn btn-primary ng-click= "arithmetic()"> Calculate !</bbutton>*
>
> *//app.js*
>
> *.....*
>
> *.controller('myctrl', [])*
>
> *......*
>
> *$scope.arithmetic = function (){*
>
> * add(values);*
>
> * subFn(values);*
>
> *  mulFn(values);*
>
> * divFn(values);*
>
> *};*
>
> *//app.spec.js*
>
> *...... *
>
> *.....*
>
> *spyOn(scope, 'arithmetic').andCallThrough;*
>
> *expect(scope.arithmetic').toHaveBeenCalled();*
>
> *// I want to check whether the add function has been called. How do I 
> write a jasmine unit test case to find this out? is this possible?*
>
>
>
> Thanks,
> Varun Krishna. P
>

-- 
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