Thanks Michael, I see where I was going wrong now. I'll look into end to end tests they sound more like what I was thinking.
Stephen On Wednesday, June 25, 2014 3:21:22 PM UTC+1, Michael Bielski wrote: > > Unit tests focus on a specific piece of code and make sure that it does > what it is supposed to (like checking a calculation.) What you are talking > about in checking that the form is completed borders on an End-2-End test, > which tests the functionality of the app in a more user-like manner (fill > in data, click a button, see what was expected.) I think that you would be > better off to rely on $invalid or $valid enabling or disabling your Save > button when all of your required fields are filled in. You could also refer > to a function that returns true or false in your ng-disabled field. > > This being said, running a unit test on your save data function would > require that you assign values to the models in question and then run the > function that saves the data and see if the result is what you expected it > to be. There are plenty of examples out there on how to do this. > -- 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.
