linkComponentFixture
npm Package | @angular/core |
---|---|
Module | import { ComponentFixture } from '@angular/core/testing'; |
Source | core/testing/src/component_fixture.ts |
linkOverview
class ComponentFixture<T> {
constructor(componentRef: ComponentRef<T>, ngZone: NgZone | null, _autoDetect: boolean)
debugElement: DebugElement
componentInstance: T
nativeElement: any
elementRef: ElementRef
changeDetectorRef: ChangeDetectorRef
componentRef: ComponentRef<T>
ngZone: NgZone | null
detectChanges(checkNoChanges: boolean = true): void
checkNoChanges(): void
autoDetectChanges(autoDetect: boolean = true)
isStable(): boolean
whenStable(): Promise<any>
whenRenderingDone(): Promise<any>
destroy(): void
}
linkDescription
Fixture for debugging and testing a component.
linkConstructor
constructor(componentRef: ComponentRef<T>, ngZone: NgZone | null, _autoDetect: boolean)
linkMembers
componentRef: ComponentRef<T>
ngZone: NgZone | null
detectChanges(checkNoChanges: boolean = true): void
Trigger a change detection cycle for the component.
autoDetectChanges(autoDetect: boolean = true)
Set whether the fixture should autodetect changes.
Also runs detectChanges once so that any existing change is detected.
isStable(): boolean
Return whether the fixture is currently stable or has async tasks that have not been completed yet.
whenStable(): Promise<any>
Get a promise that resolves when the fixture is stable.
This can be used to resume testing after events have triggered asynchronous activity or asynchronous change detection.
whenRenderingDone(): Promise<any>
Get a promise that resolves when the ui state is stable following animations.