Testing forms in Angular
To make sure we build robust and bug-free forms for end users, it is a really good idea to have tests relating to your forms. It makes the code more resilient and less prone to errors. In this recipe, you'll learn how to test your template-driven forms using unit tests.
Getting ready
The app that we are going to work with resides in start/apps/chapter08/ng-testing-forms
inside the cloned repository:
- Open the code repository in your Code Editor.
- Open the terminal, navigate to the code repository directory and run
npm run serve ng-testing-forms with-server
to serve the project along with the backend server
This should open the app in a new browser tab. And you should see the following:
Now that we have the app running locally, let's see the steps involved in this recipe in the next section.
How to do it…
We have an app that contains three different components. The first...