Testing Forms

Learn how to test different components of Angular forms.

We will learn how to test Angular forms. Previously, we learned that forms are an integral part of an Angular application. It is rare for an Angular application not to at least have a simple form, such as a search form. We have already learned that reactive forms are better than template-driven forms in many ways and are easier to test. So, in this section, we will focus on only testing reactive forms.

Testing the form input

Consider the following search.component.ts file:

Get hands-on with 1200+ tech skills courses.