DirectiveFixture
Fixture for debugging and testing a directive.
On this page
API
class DirectiveFixture<T> extends AbstractFixture<Element> { constructor(hostRef: ComponentRef<unknown>, directiveInstance: T); readonly directiveInstance: T; onDestroy(callback: () => void): void; override debugElement: DebugElement; override nativeElement: E; override elementRef: ElementRef<E>; readonly override changeDetectorRef: ChangeDetectorRef; override detectChanges(checkNoChanges?: boolean): void; override checkNoChanges(): void; override autoDetectChanges(autoDetect: boolean): void; override autoDetectChanges(): void; override isStable(): boolean; override whenStable(): Promise<any>; override whenRenderingDone(): Promise<any>; override destroy(): void;}
onDestroy
voidRegisters a callback that will be invoked when the fixture is destroyed.
() => voidvoidchangeDetectorRef
ChangeDetectorRefdetectChanges
voidTrigger a change detection cycle for the component.
booleanvoidautoDetectChanges
2 overloadsSet whether the fixture should autodetect changes.
Also runs detectChanges once so that any existing change is detected.
booleanWhether to autodetect changes. By default, true.
voidEnables automatically synchronizing the view, as it would in an application.
Also runs detectChanges once so that any existing change is detected.
voidisStable
booleanReturn whether the fixture is currently stable or has async tasks that have not been completed yet.
booleanwhenStable
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.
Promise<any>whenRenderingDone
Promise<any>Get a promise that resolves when the ui state is stable following animations.
Promise<any>