1

I have using Jasmine, Karma for writing unit test case. There is button for "create new user" link, If this button clicked it redirect to "/users/new". I want to check that whether this functionality works or not?

1 Answer 1

1

Karma and Jasmine are used for testing controller and service code only. Inside your unit tests you would call the code that is triggered by a button click event. You would then create a Jasmine Spy to spy on $state.go (assuming you are using ui-router) to check it was called with expected values.

If you want to test the actual button click then you need to use E2E (end to end) testing. You use protractor for this!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.