Is there a way to submit a form in unit test ?
I have a form like
<!-- notice that the controller is defined using controllerAs syntax -->
<form name="sign_up" ng-submit="auth.signUp(email, password)" role="form">
for example
SignUpCtrl = new _$controller_ 'SignUpCtrl', $scope: scope
SignUpForm = scope.sign_up # this holds the signup form
it '#signUp(email, password)', ->
controllerSignUpMethod = sinon.spy SignUpCtrl, 'signUp'
SignUpForm.email.$setViewValue 'em@il.com'
SignUpForm.password.$setViewValue 'pa$$word'
SignUpForm.confirm_password.$setViewValue 'pa$$word'
# I can't find a way to submit the form here
expect(controllerSignUpMethod).to.be.called
the SignUpForm is angular fromController.. but it I can't find a way to use it or the scope to submit the form...
One last thing... due some unfortunates I cannot use protractor or any other e2e package... my only option is to go with the unit tests... and the views (signup form) could be changed later... so there must exist a unit test for it to insure that it's still calling the correct controller with the correct parameters... the SignUpForm is loaded from templates in each test... so it's the actual form not just a mocked $templateCache of it