Utilities to test components

So far, we have tested our components with plain vanilla JavaScript. The fact that components are in regular classes makes this possible. However, this can only be done for very simple use cases. As soon as we want to test components for things that involve template compilation, user interaction on components, change detection, or dependency injection, we'll need to get a little help from Angular to perform our tests.

Angular comes with a whole bunch of testing tools that can help us out here. In fact, the platform-agnostic way that Angular is built allows us to exchange the regular view adapter with a debug view adapter. This enables us to render components in such a way that we can inspect them in greater detail. ...

Get Mastering Angular Components now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.