RouterTestingHarness
A testing harness for the Router to reduce the boilerplate needed to test routes and routed
components.
constructor
RouterTestingHarnessRouterTestingHarnessfixture
ComponentFixture<{ routerOutletData: WritableSignal<unknown>; }>Fixture of the root component of the RouterTestingHarness
detectChanges
voidInstructs the root fixture to run change detection.
voidrouteDebugElement
DebugElement | nullThe DebugElement of the RouterOutlet component. null if the outlet is not activated.
routeNativeElement
HTMLElement | nullThe native element of the RouterOutlet component. null if the outlet is not activated.
create
Promise<RouterTestingHarness>Creates a RouterTestingHarness instance.
The RouterTestingHarness also creates its own root component with a RouterOutlet for the
purposes of rendering route components.
Throws an error if an instance has already been created.
Use of this harness also requires destroyAfterEach: true in the ModuleTeardownOptions
string | undefinedThe target of navigation to trigger before returning the harness.
Promise<RouterTestingHarness>