Using TestBed for running Angular tests

Angular comes with another very important testing utility. So far, we have only tested the component class of our components. However, as soon as we need to test components and their behaviors in our application, a few more things will be involved:

  • Testing the view of components: It's sometimes required that we test the rendered view of components. With all of the bindings in our view, dynamic instantiation using template directives and content projection, it can be hard to write deterministic tests.
  • Testing change detection: As soon as we update our model in our component class, we will want to test the updates that are performed via change detection. This involves the whole change detection behavior ...

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.