UNPKG

2.32 kBTypeScriptView Raw
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 */
8import { ChangeDetectorRef, ComponentRef, DebugElement, ElementRef, NgZone } from '@angular/core';
9/**
10 * Fixture for debugging and testing a component.
11 *
12 * @stable
13 */
14export declare class ComponentFixture<T> {
15 componentRef: ComponentRef<T>;
16 ngZone: NgZone;
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 _isStable;
39 private _isDestroyed;
40 private _resolve;
41 private _promise;
42 private _onUnstableSubscription;
43 private _onStableSubscription;
44 private _onMicrotaskEmptySubscription;
45 private _onErrorSubscription;
46 constructor(componentRef: ComponentRef<T>, ngZone: NgZone, _autoDetect: boolean);
47 private _tick(checkNoChanges);
48 /**
49 * Trigger a change detection cycle for the component.
50 */
51 detectChanges(checkNoChanges?: boolean): void;
52 /**
53 * Do a change detection run to make sure there were no changes.
54 */
55 checkNoChanges(): void;
56 /**
57 * Set whether the fixture should autodetect changes.
58 *
59 * Also runs detectChanges once so that any existing change is detected.
60 */
61 autoDetectChanges(autoDetect?: boolean): void;
62 /**
63 * Return whether the fixture is currently stable or has async tasks that have not been completed
64 * yet.
65 */
66 isStable(): boolean;
67 /**
68 * Get a promise that resolves when the fixture is stable.
69 *
70 * This can be used to resume testing after events have triggered asynchronous activity or
71 * asynchronous change detection.
72 */
73 whenStable(): Promise<any>;
74 /**
75 * Trigger component destruction.
76 */
77 destroy(): void;
78}