RouterTestingHarness
A testing harness for the Router
to reduce the boilerplate needed to test routes and routed
components.
class RouterTestingHarness {}
fixture
ComponentFixture<{ routerOutletData: WritableSignal<unknown>; }>
Fixture of the root component of the RouterTestingHarness
detectChanges
void
Instructs the root fixture to run change detection.
void
routeDebugElement
DebugElement | null
The DebugElement
of the RouterOutlet
component. null
if the outlet is not activated.
routeNativeElement
HTMLElement | null
The 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 | undefined
The target of navigation to trigger before returning the harness.
Promise<RouterTestingHarness>