Testing components

Here is our AboutComponent, which just displays the property values on the template; this is the right place to start writing some integrated unit tests:

The code for src/app/about.component.ts is as follows:

import { Component } from '@angular/core';@Component({   selector: 'about-page',   template: `     <div>       <h4>{{heading}}</h4>       <p class="message">{{content}}</p>     </div>   `, }) export class AboutComponent {   heading = 'This is About Page';   content = ''; } 

The code for src/app/about.component.integrated.spec.ts is as follows:

import { ComponentFixture, TestBed }                            from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; import { AboutComponent } from './about.component'; ...

Get Building Modern Web Applications using Angular now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.