ComponentFixture
Fixture for debugging and testing a component.
abstract class ComponentFixture<T> {
debugElement: DebugElement
componentInstance: T
nativeElement: any
elementRef: ElementRef
changeDetectorRef: ChangeDetectorRef
ngZone: this._noZoneOptionIsSet ? null : this._ngZone
componentRef: ComponentRef<T>
abstract detectChanges(checkNoChanges?: boolean): void
checkNoChanges(): void
abstract autoDetectChanges(autoDetect?: boolean): void
abstract isStable(): boolean
abstract whenStable(): Promise<any>
getDeferBlocks(): Promise<DeferBlockFixture[]>
whenRenderingDone(): Promise<any>
destroy(): void
}
Properties
Property | Description |
---|---|
debugElement: DebugElement
|
The DebugElement associated with the root element of this component. |
componentInstance: T
|
The instance of the root component class. |
nativeElement: any
|
The native element at the root of the component. |
elementRef: ElementRef
|
The ElementRef for the element at the root of the component. |
changeDetectorRef: ChangeDetectorRef
|
The ChangeDetectorRef for the component |
ngZone: this._noZoneOptionIsSet ? null : this._ngZone
|
|
componentRef: ComponentRef<T>
|
Methods
detectChanges() |
---|
Trigger a change detection cycle for the component. |
checkNoChanges() |
---|
Do a change detection run to make sure there were no changes. |
ParametersThere are no parameters. Returns
|
autoDetectChanges() |
---|
Set whether the fixture should autodetect changes. |
Also runs detectChanges once so that any existing change is detected. |
isStable() |
---|
Return whether the fixture is currently stable or has async tasks that have not been completed yet. |
ParametersThere are no parameters. Returns
|
whenStable() |
---|
Get a promise that resolves when the fixture is stable. |
ParametersThere are no parameters. Returns
|
This can be used to resume testing after events have triggered asynchronous activity or asynchronous change detection. |
getDeferBlocks() |
---|
Retrieves all defer block fixtures in the component fixture. |
ParametersThere are no parameters. Returns
|
whenRenderingDone() |
---|
Get a promise that resolves when the ui state is stable following animations. |
ParametersThere are no parameters. Returns
|
destroy() |
---|
Trigger component destruction. |
ParametersThere are no parameters. Returns
|