1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. All Rights Reserved.
|
4
|
*
|
5
|
* Use of this source code is governed by an MIT-style license that can be
|
6
|
* found in the LICENSE file at https://angular.io/license
|
7
|
*/
|
8
|
import { ChangeDetectorRef, ComponentRef, DebugElement, ElementRef, NgZone } from '@angular/core';
|
9
|
/**
|
10
|
* Fixture for debugging and testing a component.
|
11
|
*
|
12
|
* @stable
|
13
|
*/
|
14
|
export declare class ComponentFixture<T> {
|
15
|
componentRef: ComponentRef<T>;
|
16
|
ngZone: NgZone | null;
|
17
|
private _autoDetect;
|
18
|
/**
|
19
|
* The DebugElement associated with the root element of this component.
|
20
|
*/
|
21
|
debugElement: DebugElement;
|
22
|
/**
|
23
|
* The instance of the root component class.
|
24
|
*/
|
25
|
componentInstance: T;
|
26
|
/**
|
27
|
* The native element at the root of the component.
|
28
|
*/
|
29
|
nativeElement: any;
|
30
|
/**
|
31
|
* The ElementRef for the element at the root of the component.
|
32
|
*/
|
33
|
elementRef: ElementRef;
|
34
|
/**
|
35
|
* The ChangeDetectorRef for the component
|
36
|
*/
|
37
|
changeDetectorRef: ChangeDetectorRef;
|
38
|
private _renderer;
|
39
|
private _isStable;
|
40
|
private _isDestroyed;
|
41
|
private _resolve;
|
42
|
private _promise;
|
43
|
private _onUnstableSubscription;
|
44
|
private _onStableSubscription;
|
45
|
private _onMicrotaskEmptySubscription;
|
46
|
private _onErrorSubscription;
|
47
|
constructor(componentRef: ComponentRef<T>, ngZone: NgZone | null, _autoDetect: boolean);
|
48
|
private _tick(checkNoChanges);
|
49
|
/**
|
50
|
* Trigger a change detection cycle for the component.
|
51
|
*/
|
52
|
detectChanges(checkNoChanges?: boolean): void;
|
53
|
/**
|
54
|
* Do a change detection run to make sure there were no changes.
|
55
|
*/
|
56
|
checkNoChanges(): void;
|
57
|
/**
|
58
|
* Set whether the fixture should autodetect changes.
|
59
|
*
|
60
|
* Also runs detectChanges once so that any existing change is detected.
|
61
|
*/
|
62
|
autoDetectChanges(autoDetect?: boolean): void;
|
63
|
/**
|
64
|
* Return whether the fixture is currently stable or has async tasks that have not been completed
|
65
|
* yet.
|
66
|
*/
|
67
|
isStable(): boolean;
|
68
|
/**
|
69
|
* Get a promise that resolves when the fixture is stable.
|
70
|
*
|
71
|
* This can be used to resume testing after events have triggered asynchronous activity or
|
72
|
* asynchronous change detection.
|
73
|
*/
|
74
|
whenStable(): Promise<any>;
|
75
|
private _getRenderer();
|
76
|
/**
|
77
|
* Get a promise that resolves when the ui state is stable following animations.
|
78
|
*/
|
79
|
whenRenderingDone(): Promise<any>;
|
80
|
/**
|
81
|
* Trigger component destruction.
|
82
|
*/
|
83
|
destroy(): void;
|
84
|
}
|