@angular/core 19.2.1 → 19.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/core.mjs +278 -1590
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -589
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +18 -8
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +7 -11
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +114 -129
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/weak_ref-DrMdAIDh.mjs +12 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs.map +1 -0
- package/index.d.ts +14205 -14988
- package/navigation_types.d-u4EOrrdZ.d.ts +121 -0
- package/package.json +1 -1
- package/primitives/di/index.d.ts +42 -50
- package/primitives/event-dispatch/index.d.ts +205 -309
- package/primitives/signals/index.d.ts +158 -195
- package/rxjs-interop/index.d.ts +72 -91
- package/schematics/bundles/{apply_import_manager-b8d6885d.js → apply_import_manager-C8MABThs.js} +12 -16
- package/schematics/bundles/{checker-89987c98.js → checker-DP-zos5Q.js} +2959 -1054
- package/schematics/bundles/cleanup-unused-imports.js +21 -27
- package/schematics/bundles/{compiler_host-2398e4ca.js → compiler_host-DzM2hemp.js} +19 -23
- package/schematics/bundles/control-flow-migration.js +81 -38
- package/schematics/bundles/explicit-standalone-flag.js +26 -32
- package/schematics/bundles/{imports-047fbbc8.js → imports-CIX-JgAN.js} +9 -14
- package/schematics/bundles/{index-e0b2e4a7.js → index-CEdDCtp8.js} +55 -59
- package/schematics/bundles/{index-10911843.js → index-CrKEaRj_.js} +4 -4
- package/schematics/bundles/inject-migration.js +121 -127
- package/schematics/bundles/{leading_space-f8944434.js → leading_space-D9nQ8UQC.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-52508cd4.js → migrate_ts_type_references-C0325A9V.js} +106 -111
- package/schematics/bundles/{ng_decorators-b0d8b324.js → ng_decorators-DznZ5jMl.js} +4 -8
- package/schematics/bundles/{nodes-7758dbf6.js → nodes-B16H9JUd.js} +2 -6
- package/schematics/bundles/output-migration.js +39 -45
- package/schematics/bundles/pending-tasks.js +13 -19
- package/schematics/bundles/{program-0e1d4f10.js → program-CRYsSwIq.js} +768 -2633
- package/schematics/bundles/{project_paths-c48796dd.js → project_paths-BoRVJPjW.js} +25 -23
- package/schematics/bundles/{project_tsconfig_paths-b558633b.js → project_tsconfig_paths-CDVxT6Ov.js} +1 -1
- package/schematics/bundles/{property_name-ac18447e.js → property_name-BBwFuqMe.js} +3 -7
- package/schematics/bundles/provide-initializer.js +13 -19
- package/schematics/bundles/route-lazy-loading.js +35 -41
- package/schematics/bundles/self-closing-tags-migration.js +19 -25
- package/schematics/bundles/signal-input-migration.js +60 -67
- package/schematics/bundles/signal-queries-migration.js +47 -54
- package/schematics/bundles/signals.js +9 -11
- package/schematics/bundles/standalone-migration.js +178 -184
- package/testing/index.d.ts +289 -462
- package/weak_ref.d-ttyj86RV.d.ts +9 -0
package/testing/index.d.ts
CHANGED
|
@@ -1,46 +1,60 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.2.
|
|
2
|
+
* @license Angular v19.2.2
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
import { ComponentRef } from '@angular/core';
|
|
11
|
-
import { DebugElement } from '@angular/core';
|
|
12
|
-
import { ɵDeferBlockBehavior as DeferBlockBehavior } from '@angular/core';
|
|
13
|
-
import { ɵDeferBlockState as DeferBlockState } from '@angular/core';
|
|
14
|
-
import { Directive } from '@angular/core';
|
|
15
|
-
import { ElementRef } from '@angular/core';
|
|
16
|
-
import { InjectFlags } from '@angular/core';
|
|
17
|
-
import { InjectionToken } from '@angular/core';
|
|
18
|
-
import { InjectOptions } from '@angular/core';
|
|
19
|
-
import { NgModule } from '@angular/core';
|
|
20
|
-
import { NgZone } from '@angular/core';
|
|
21
|
-
import { Pipe } from '@angular/core';
|
|
22
|
-
import { PlatformRef } from '@angular/core';
|
|
23
|
-
import { ProviderToken } from '@angular/core';
|
|
24
|
-
import { SchemaMetadata } from '@angular/core';
|
|
25
|
-
import { Type } from '@angular/core';
|
|
26
|
-
import { ɵDeferBlockDetails } from '@angular/core';
|
|
7
|
+
import { ɵDeferBlockDetails as _DeferBlockDetails, ɵDeferBlockState as _DeferBlockState, ComponentRef, DebugElement, ElementRef, ChangeDetectorRef, NgZone, SchemaMetadata, ɵDeferBlockBehavior as _DeferBlockBehavior, InjectionToken, PlatformRef, Type, ProviderToken, InjectOptions, InjectFlags, NgModule, Component, Directive, Pipe } from '@angular/core';
|
|
8
|
+
export { ɵDeferBlockBehavior as DeferBlockBehavior, ɵDeferBlockState as DeferBlockState } from '@angular/core';
|
|
9
|
+
import { a as Navigation, c as NavigationHistoryEntry, d as NavigationNavigateOptions, g as NavigationResult, e as NavigationOptions, N as NavigateEvent, b as NavigationCurrentEntryChangeEvent, h as NavigationTransition, i as NavigationUpdateCurrentEntryOptions, f as NavigationReloadOptions } from '../navigation_types.d-u4EOrrdZ.js';
|
|
27
10
|
|
|
28
11
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
12
|
+
* Wraps a test function in an asynchronous test zone. The test will automatically
|
|
13
|
+
* complete when all asynchronous calls within this zone are done. Can be used
|
|
14
|
+
* to wrap an {@link inject} call.
|
|
31
15
|
*
|
|
32
|
-
*
|
|
16
|
+
* Example:
|
|
33
17
|
*
|
|
34
|
-
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* it('...', waitForAsync(inject([AClass], (object) => {
|
|
20
|
+
* object.doSomething.then(() => {
|
|
21
|
+
* expect(...);
|
|
22
|
+
* })
|
|
23
|
+
* })));
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @publicApi
|
|
27
|
+
*/
|
|
28
|
+
declare function waitForAsync(fn: Function): (done: any) => any;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Represents an individual defer block for testing purposes.
|
|
32
|
+
*
|
|
33
|
+
* @publicApi
|
|
35
34
|
*/
|
|
36
|
-
|
|
35
|
+
declare class DeferBlockFixture {
|
|
36
|
+
private block;
|
|
37
|
+
private componentFixture;
|
|
38
|
+
/** @nodoc */
|
|
39
|
+
constructor(block: _DeferBlockDetails, componentFixture: ComponentFixture<unknown>);
|
|
40
|
+
/**
|
|
41
|
+
* Renders the specified state of the defer fixture.
|
|
42
|
+
* @param state the defer state to render
|
|
43
|
+
*/
|
|
44
|
+
render(state: _DeferBlockState): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves all nested child defer block fixtures
|
|
47
|
+
* in a given defer block.
|
|
48
|
+
*/
|
|
49
|
+
getDeferBlocks(): Promise<DeferBlockFixture[]>;
|
|
50
|
+
}
|
|
37
51
|
|
|
38
52
|
/**
|
|
39
53
|
* Fixture for debugging and testing a component.
|
|
40
54
|
*
|
|
41
55
|
* @publicApi
|
|
42
56
|
*/
|
|
43
|
-
|
|
57
|
+
declare class ComponentFixture<T> {
|
|
44
58
|
componentRef: ComponentRef<T>;
|
|
45
59
|
/**
|
|
46
60
|
* The DebugElement associated with the root element of this component.
|
|
@@ -121,48 +135,12 @@ export declare class ComponentFixture<T> {
|
|
|
121
135
|
}
|
|
122
136
|
|
|
123
137
|
/**
|
|
124
|
-
*
|
|
125
|
-
|
|
126
|
-
export declare const ComponentFixtureAutoDetect: InjectionToken<boolean>;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* @publicApi
|
|
130
|
-
*/
|
|
131
|
-
export declare const ComponentFixtureNoNgZone: InjectionToken<boolean>;
|
|
132
|
-
|
|
133
|
-
export { DeferBlockBehavior }
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Represents an individual defer block for testing purposes.
|
|
137
|
-
*
|
|
138
|
-
* @publicApi
|
|
139
|
-
*/
|
|
140
|
-
export declare class DeferBlockFixture {
|
|
141
|
-
private block;
|
|
142
|
-
private componentFixture;
|
|
143
|
-
/** @nodoc */
|
|
144
|
-
constructor(block: ɵDeferBlockDetails, componentFixture: ComponentFixture<unknown>);
|
|
145
|
-
/**
|
|
146
|
-
* Renders the specified state of the defer fixture.
|
|
147
|
-
* @param state the defer state to render
|
|
148
|
-
*/
|
|
149
|
-
render(state: DeferBlockState): Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
* Retrieves all nested child defer block fixtures
|
|
152
|
-
* in a given defer block.
|
|
153
|
-
*/
|
|
154
|
-
getDeferBlocks(): Promise<DeferBlockFixture[]>;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export { DeferBlockState }
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Discard all remaining periodic tasks.
|
|
138
|
+
* Clears out the shared fake async zone for a test.
|
|
139
|
+
* To be called in a global `beforeEach`.
|
|
161
140
|
*
|
|
162
141
|
* @publicApi
|
|
163
142
|
*/
|
|
164
|
-
|
|
165
|
-
|
|
143
|
+
declare function resetFakeAsyncZone(): void;
|
|
166
144
|
/**
|
|
167
145
|
* Wraps a function to be executed in the `fakeAsync` zone:
|
|
168
146
|
* - Microtasks are manually executed by calling `flushMicrotasks()`.
|
|
@@ -187,49 +165,76 @@ export declare function discardPeriodicTasks(): void;
|
|
|
187
165
|
*
|
|
188
166
|
* @publicApi
|
|
189
167
|
*/
|
|
190
|
-
|
|
168
|
+
declare function fakeAsync(fn: Function, options?: {
|
|
191
169
|
flush?: boolean;
|
|
192
170
|
}): (...args: any[]) => any;
|
|
193
|
-
|
|
194
171
|
/**
|
|
195
|
-
*
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
*
|
|
226
|
-
*
|
|
172
|
+
* Simulates the asynchronous passage of time for the timers in the `fakeAsync` zone.
|
|
173
|
+
*
|
|
174
|
+
* The microtasks queue is drained at the very start of this function and after any timer callback
|
|
175
|
+
* has been executed.
|
|
176
|
+
*
|
|
177
|
+
* @param millis The number of milliseconds to advance the virtual timer.
|
|
178
|
+
* @param tickOptions The options to pass to the `tick()` function.
|
|
179
|
+
*
|
|
180
|
+
* @usageNotes
|
|
181
|
+
*
|
|
182
|
+
* The `tick()` option is a flag called `processNewMacroTasksSynchronously`,
|
|
183
|
+
* which determines whether or not to invoke new macroTasks.
|
|
184
|
+
*
|
|
185
|
+
* If you provide a `tickOptions` object, but do not specify a
|
|
186
|
+
* `processNewMacroTasksSynchronously` property (`tick(100, {})`),
|
|
187
|
+
* then `processNewMacroTasksSynchronously` defaults to true.
|
|
188
|
+
*
|
|
189
|
+
* If you omit the `tickOptions` parameter (`tick(100))`), then
|
|
190
|
+
* `tickOptions` defaults to `{processNewMacroTasksSynchronously: true}`.
|
|
191
|
+
*
|
|
192
|
+
* ### Example
|
|
193
|
+
*
|
|
194
|
+
* {@example core/testing/ts/fake_async.ts region='basic'}
|
|
195
|
+
*
|
|
196
|
+
* The following example includes a nested timeout (new macroTask), and
|
|
197
|
+
* the `tickOptions` parameter is allowed to default. In this case,
|
|
198
|
+
* `processNewMacroTasksSynchronously` defaults to true, and the nested
|
|
199
|
+
* function is executed on each tick.
|
|
200
|
+
*
|
|
201
|
+
* ```ts
|
|
202
|
+
* it ('test with nested setTimeout', fakeAsync(() => {
|
|
203
|
+
* let nestedTimeoutInvoked = false;
|
|
204
|
+
* function funcWithNestedTimeout() {
|
|
205
|
+
* setTimeout(() => {
|
|
206
|
+
* nestedTimeoutInvoked = true;
|
|
207
|
+
* });
|
|
208
|
+
* };
|
|
209
|
+
* setTimeout(funcWithNestedTimeout);
|
|
210
|
+
* tick();
|
|
211
|
+
* expect(nestedTimeoutInvoked).toBe(true);
|
|
212
|
+
* }));
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* In the following case, `processNewMacroTasksSynchronously` is explicitly
|
|
216
|
+
* set to false, so the nested timeout function is not invoked.
|
|
217
|
+
*
|
|
218
|
+
* ```ts
|
|
219
|
+
* it ('test with nested setTimeout', fakeAsync(() => {
|
|
220
|
+
* let nestedTimeoutInvoked = false;
|
|
221
|
+
* function funcWithNestedTimeout() {
|
|
222
|
+
* setTimeout(() => {
|
|
223
|
+
* nestedTimeoutInvoked = true;
|
|
224
|
+
* });
|
|
225
|
+
* };
|
|
226
|
+
* setTimeout(funcWithNestedTimeout);
|
|
227
|
+
* tick(0, {processNewMacroTasksSynchronously: false});
|
|
228
|
+
* expect(nestedTimeoutInvoked).toBe(false);
|
|
229
|
+
* }));
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
*
|
|
233
|
+
* @publicApi
|
|
227
234
|
*/
|
|
228
|
-
declare
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
235
|
+
declare function tick(millis?: number, tickOptions?: {
|
|
236
|
+
processNewMacroTasksSynchronously: boolean;
|
|
237
|
+
}): void;
|
|
233
238
|
/**
|
|
234
239
|
* Flushes any pending microtasks and simulates the asynchronous passage of time for the timers in
|
|
235
240
|
* the `fakeAsync` zone by
|
|
@@ -241,222 +246,142 @@ declare interface FakeNavigationResult extends NavigationResult {
|
|
|
241
246
|
*
|
|
242
247
|
* @publicApi
|
|
243
248
|
*/
|
|
244
|
-
|
|
245
|
-
|
|
249
|
+
declare function flush(maxTurns?: number): number;
|
|
246
250
|
/**
|
|
247
|
-
*
|
|
251
|
+
* Discard all remaining periodic tasks.
|
|
248
252
|
*
|
|
249
253
|
* @publicApi
|
|
250
254
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
declare function discardPeriodicTasks(): void;
|
|
253
256
|
/**
|
|
254
|
-
*
|
|
257
|
+
* Flush any pending microtasks.
|
|
255
258
|
*
|
|
256
259
|
* @publicApi
|
|
257
260
|
*/
|
|
258
|
-
|
|
261
|
+
declare function flushMicrotasks(): void;
|
|
259
262
|
|
|
260
263
|
/**
|
|
261
|
-
*
|
|
262
|
-
* (imported from the `@angular/core/testing` package) can **only** be used to inject dependencies
|
|
263
|
-
* in tests. To inject dependencies in your application code, use the [`inject`](api/core/inject)
|
|
264
|
-
* function from the `@angular/core` package instead.
|
|
265
|
-
*
|
|
266
|
-
* Example:
|
|
267
|
-
*
|
|
268
|
-
* ```ts
|
|
269
|
-
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
|
270
|
-
* // some code that uses `dep` and `object`
|
|
271
|
-
* // ...
|
|
272
|
-
* }));
|
|
273
|
-
*
|
|
274
|
-
* it('...', inject([AClass], (object) => {
|
|
275
|
-
* object.doSomething();
|
|
276
|
-
* expect(...);
|
|
277
|
-
* })
|
|
278
|
-
* ```
|
|
264
|
+
* Type used for modifications to metadata
|
|
279
265
|
*
|
|
280
266
|
* @publicApi
|
|
281
267
|
*/
|
|
282
|
-
|
|
268
|
+
type MetadataOverride<T> = {
|
|
269
|
+
add?: Partial<T>;
|
|
270
|
+
remove?: Partial<T>;
|
|
271
|
+
set?: Partial<T>;
|
|
272
|
+
};
|
|
283
273
|
|
|
284
274
|
/**
|
|
275
|
+
* An abstract class for inserting the root test component element in a platform independent way.
|
|
276
|
+
*
|
|
285
277
|
* @publicApi
|
|
286
278
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
private _addModule;
|
|
291
|
-
inject(tokens: any[], fn: Function): () => any;
|
|
279
|
+
declare class TestComponentRenderer {
|
|
280
|
+
insertRootElement(rootElementId: string): void;
|
|
281
|
+
removeAllRootElements?(): void;
|
|
292
282
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
283
|
/**
|
|
296
|
-
* Type used for modifications to metadata
|
|
297
|
-
*
|
|
298
284
|
* @publicApi
|
|
299
285
|
*/
|
|
300
|
-
|
|
301
|
-
add?: Partial<T>;
|
|
302
|
-
remove?: Partial<T>;
|
|
303
|
-
set?: Partial<T>;
|
|
304
|
-
};
|
|
305
|
-
|
|
286
|
+
declare const ComponentFixtureAutoDetect: InjectionToken<boolean>;
|
|
306
287
|
/**
|
|
307
|
-
* Configures the test module teardown behavior in `TestBed`.
|
|
308
288
|
* @publicApi
|
|
309
289
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
reload(options?: NavigationReloadOptions): NavigationResult;
|
|
353
|
-
traverseTo(key: string, options?: NavigationOptions): NavigationResult;
|
|
354
|
-
back(options?: NavigationOptions): NavigationResult;
|
|
355
|
-
forward(options?: NavigationOptions): NavigationResult;
|
|
356
|
-
onnavigate: ((this: Navigation, ev: NavigateEvent) => any) | null;
|
|
357
|
-
onnavigatesuccess: ((this: Navigation, ev: Event) => any) | null;
|
|
358
|
-
onnavigateerror: ((this: Navigation, ev: ErrorEvent) => any) | null;
|
|
359
|
-
oncurrententrychange: ((this: Navigation, ev: NavigationCurrentEntryChangeEvent) => any) | null;
|
|
360
|
-
addEventListener<K extends keyof NavigationEventMap>(type: K, listener: (this: Navigation, ev: NavigationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
361
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
362
|
-
removeEventListener<K extends keyof NavigationEventMap>(type: K, listener: (this: Navigation, ev: NavigationEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
363
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
declare class NavigationCurrentEntryChangeEvent extends Event {
|
|
367
|
-
constructor(type: string, eventInit?: NavigationCurrentEntryChangeEventInit);
|
|
368
|
-
readonly navigationType: NavigationTypeString | null;
|
|
369
|
-
readonly from: NavigationHistoryEntry;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
declare interface NavigationCurrentEntryChangeEventInit extends EventInit {
|
|
373
|
-
navigationType?: NavigationTypeString | null;
|
|
374
|
-
from: NavigationHistoryEntry;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
declare class NavigationDestination {
|
|
378
|
-
readonly url: string;
|
|
379
|
-
readonly key: string | null;
|
|
380
|
-
readonly id: string | null;
|
|
381
|
-
readonly index: number;
|
|
382
|
-
readonly sameDocument: boolean;
|
|
383
|
-
getState(): unknown;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
declare interface NavigationEventMap {
|
|
388
|
-
navigate: NavigateEvent;
|
|
389
|
-
navigatesuccess: Event;
|
|
390
|
-
navigateerror: ErrorEvent;
|
|
391
|
-
currententrychange: NavigationCurrentEntryChangeEvent;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
declare class NavigationHistoryEntry extends EventTarget {
|
|
395
|
-
readonly key: string;
|
|
396
|
-
readonly id: string;
|
|
397
|
-
readonly url: string | null;
|
|
398
|
-
readonly index: number;
|
|
399
|
-
readonly sameDocument: boolean;
|
|
400
|
-
getState(): unknown;
|
|
401
|
-
ondispose: ((this: NavigationHistoryEntry, ev: Event) => any) | null;
|
|
402
|
-
addEventListener<K extends keyof NavigationHistoryEntryEventMap>(type: K, listener: (this: NavigationHistoryEntry, ev: NavigationHistoryEntryEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
403
|
-
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
404
|
-
removeEventListener<K extends keyof NavigationHistoryEntryEventMap>(type: K, listener: (this: NavigationHistoryEntry, ev: NavigationHistoryEntryEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
405
|
-
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
declare interface NavigationHistoryEntryEventMap {
|
|
409
|
-
dispose: Event;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
declare interface NavigationInterceptOptions {
|
|
413
|
-
handler?: () => Promise<void>;
|
|
414
|
-
focusReset?: 'after-transition' | 'manual';
|
|
415
|
-
scroll?: 'after-transition' | 'manual';
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
declare interface NavigationNavigateOptions extends NavigationOptions {
|
|
419
|
-
state?: unknown;
|
|
420
|
-
history?: 'auto' | 'push' | 'replace';
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
declare interface NavigationOptions {
|
|
424
|
-
info?: unknown;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
declare interface NavigationReloadOptions extends NavigationOptions {
|
|
428
|
-
state?: unknown;
|
|
290
|
+
declare const ComponentFixtureNoNgZone: InjectionToken<boolean>;
|
|
291
|
+
/**
|
|
292
|
+
* @publicApi
|
|
293
|
+
*/
|
|
294
|
+
interface TestModuleMetadata {
|
|
295
|
+
providers?: any[];
|
|
296
|
+
declarations?: any[];
|
|
297
|
+
imports?: any[];
|
|
298
|
+
schemas?: Array<SchemaMetadata | any[]>;
|
|
299
|
+
teardown?: ModuleTeardownOptions;
|
|
300
|
+
/**
|
|
301
|
+
* Whether NG0304 runtime errors should be thrown when unknown elements are present in component's
|
|
302
|
+
* template. Defaults to `false`, where the error is simply logged. If set to `true`, the error is
|
|
303
|
+
* thrown.
|
|
304
|
+
* @see [NG8001](/errors/NG8001) for the description of the problem and how to fix it
|
|
305
|
+
*/
|
|
306
|
+
errorOnUnknownElements?: boolean;
|
|
307
|
+
/**
|
|
308
|
+
* Whether errors should be thrown when unknown properties are present in component's template.
|
|
309
|
+
* Defaults to `false`, where the error is simply logged.
|
|
310
|
+
* If set to `true`, the error is thrown.
|
|
311
|
+
* @see [NG8002](/errors/NG8002) for the description of the error and how to fix it
|
|
312
|
+
*/
|
|
313
|
+
errorOnUnknownProperties?: boolean;
|
|
314
|
+
/**
|
|
315
|
+
* Whether errors that happen during application change detection should be rethrown.
|
|
316
|
+
*
|
|
317
|
+
* When `true`, errors that are caught during application change detection will
|
|
318
|
+
* be reported to the `ErrorHandler` and rethrown to prevent them from going
|
|
319
|
+
* unnoticed in tests.
|
|
320
|
+
*
|
|
321
|
+
* When `false`, errors are only forwarded to the `ErrorHandler`, which by default
|
|
322
|
+
* simply logs them to the console.
|
|
323
|
+
*
|
|
324
|
+
* Defaults to `true`.
|
|
325
|
+
*/
|
|
326
|
+
rethrowApplicationErrors?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Whether defer blocks should behave with manual triggering or play through normally.
|
|
329
|
+
* Defaults to `manual`.
|
|
330
|
+
*/
|
|
331
|
+
deferBlockBehavior?: _DeferBlockBehavior;
|
|
429
332
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
333
|
+
/**
|
|
334
|
+
* @publicApi
|
|
335
|
+
*/
|
|
336
|
+
interface TestEnvironmentOptions {
|
|
337
|
+
/**
|
|
338
|
+
* Configures the test module teardown behavior in `TestBed`.
|
|
339
|
+
*/
|
|
340
|
+
teardown?: ModuleTeardownOptions;
|
|
341
|
+
/**
|
|
342
|
+
* Whether errors should be thrown when unknown elements are present in component's template.
|
|
343
|
+
* Defaults to `false`, where the error is simply logged.
|
|
344
|
+
* If set to `true`, the error is thrown.
|
|
345
|
+
* @see [NG8001](/errors/NG8001) for the description of the error and how to fix it
|
|
346
|
+
*/
|
|
347
|
+
errorOnUnknownElements?: boolean;
|
|
348
|
+
/**
|
|
349
|
+
* Whether errors should be thrown when unknown properties are present in component's template.
|
|
350
|
+
* Defaults to `false`, where the error is simply logged.
|
|
351
|
+
* If set to `true`, the error is thrown.
|
|
352
|
+
* @see [NG8002](/errors/NG8002) for the description of the error and how to fix it
|
|
353
|
+
*/
|
|
354
|
+
errorOnUnknownProperties?: boolean;
|
|
434
355
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
356
|
+
/**
|
|
357
|
+
* Configures the test module teardown behavior in `TestBed`.
|
|
358
|
+
* @publicApi
|
|
359
|
+
*/
|
|
360
|
+
interface ModuleTeardownOptions {
|
|
361
|
+
/** Whether the test module should be destroyed after every test. Defaults to `true`. */
|
|
362
|
+
destroyAfterEach: boolean;
|
|
363
|
+
/** Whether errors during test module destruction should be re-thrown. Defaults to `true`. */
|
|
364
|
+
rethrowErrors?: boolean;
|
|
440
365
|
}
|
|
441
366
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
367
|
+
/**
|
|
368
|
+
* Static methods implemented by the `TestBed`.
|
|
369
|
+
*
|
|
370
|
+
* @publicApi
|
|
371
|
+
*/
|
|
372
|
+
interface TestBedStatic extends TestBed {
|
|
373
|
+
new (...args: any[]): TestBed;
|
|
446
374
|
}
|
|
447
|
-
|
|
448
375
|
/**
|
|
449
|
-
*
|
|
450
|
-
* To be called in a global `beforeEach`.
|
|
376
|
+
* Returns a singleton of the `TestBed` class.
|
|
451
377
|
*
|
|
452
378
|
* @publicApi
|
|
453
379
|
*/
|
|
454
|
-
|
|
455
|
-
|
|
380
|
+
declare function getTestBed(): TestBed;
|
|
456
381
|
/**
|
|
457
382
|
* @publicApi
|
|
458
383
|
*/
|
|
459
|
-
|
|
384
|
+
interface TestBed {
|
|
460
385
|
get platform(): PlatformRef;
|
|
461
386
|
get ngModule(): Type<any> | Type<any>[];
|
|
462
387
|
/**
|
|
@@ -534,7 +459,6 @@ export declare interface TestBed {
|
|
|
534
459
|
*/
|
|
535
460
|
flushEffects(): void;
|
|
536
461
|
}
|
|
537
|
-
|
|
538
462
|
/**
|
|
539
463
|
* @description
|
|
540
464
|
* Configures and initializes environment for unit testing and provides methods for
|
|
@@ -544,195 +468,72 @@ export declare interface TestBed {
|
|
|
544
468
|
*
|
|
545
469
|
* @publicApi
|
|
546
470
|
*/
|
|
547
|
-
|
|
548
|
-
|
|
471
|
+
declare const TestBed: TestBedStatic;
|
|
549
472
|
/**
|
|
550
|
-
*
|
|
473
|
+
* Allows injecting dependencies in `beforeEach()` and `it()`. Note: this function
|
|
474
|
+
* (imported from the `@angular/core/testing` package) can **only** be used to inject dependencies
|
|
475
|
+
* in tests. To inject dependencies in your application code, use the [`inject`](api/core/inject)
|
|
476
|
+
* function from the `@angular/core` package instead.
|
|
551
477
|
*
|
|
552
|
-
*
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
*
|
|
478
|
+
* Example:
|
|
479
|
+
*
|
|
480
|
+
* ```ts
|
|
481
|
+
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
|
482
|
+
* // some code that uses `dep` and `object`
|
|
483
|
+
* // ...
|
|
484
|
+
* }));
|
|
485
|
+
*
|
|
486
|
+
* it('...', inject([AClass], (object) => {
|
|
487
|
+
* object.doSomething();
|
|
488
|
+
* expect(...);
|
|
489
|
+
* })
|
|
490
|
+
* ```
|
|
560
491
|
*
|
|
561
492
|
* @publicApi
|
|
562
493
|
*/
|
|
563
|
-
|
|
564
|
-
insertRootElement(rootElementId: string): void;
|
|
565
|
-
removeAllRootElements?(): void;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* @publicApi
|
|
570
|
-
*/
|
|
571
|
-
export declare interface TestEnvironmentOptions {
|
|
572
|
-
/**
|
|
573
|
-
* Configures the test module teardown behavior in `TestBed`.
|
|
574
|
-
*/
|
|
575
|
-
teardown?: ModuleTeardownOptions;
|
|
576
|
-
/**
|
|
577
|
-
* Whether errors should be thrown when unknown elements are present in component's template.
|
|
578
|
-
* Defaults to `false`, where the error is simply logged.
|
|
579
|
-
* If set to `true`, the error is thrown.
|
|
580
|
-
* @see [NG8001](/errors/NG8001) for the description of the error and how to fix it
|
|
581
|
-
*/
|
|
582
|
-
errorOnUnknownElements?: boolean;
|
|
583
|
-
/**
|
|
584
|
-
* Whether errors should be thrown when unknown properties are present in component's template.
|
|
585
|
-
* Defaults to `false`, where the error is simply logged.
|
|
586
|
-
* If set to `true`, the error is thrown.
|
|
587
|
-
* @see [NG8002](/errors/NG8002) for the description of the error and how to fix it
|
|
588
|
-
*/
|
|
589
|
-
errorOnUnknownProperties?: boolean;
|
|
590
|
-
}
|
|
591
|
-
|
|
494
|
+
declare function inject(tokens: any[], fn: Function): () => any;
|
|
592
495
|
/**
|
|
593
496
|
* @publicApi
|
|
594
497
|
*/
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
teardown?: ModuleTeardownOptions;
|
|
601
|
-
/**
|
|
602
|
-
* Whether NG0304 runtime errors should be thrown when unknown elements are present in component's
|
|
603
|
-
* template. Defaults to `false`, where the error is simply logged. If set to `true`, the error is
|
|
604
|
-
* thrown.
|
|
605
|
-
* @see [NG8001](/errors/NG8001) for the description of the problem and how to fix it
|
|
606
|
-
*/
|
|
607
|
-
errorOnUnknownElements?: boolean;
|
|
608
|
-
/**
|
|
609
|
-
* Whether errors should be thrown when unknown properties are present in component's template.
|
|
610
|
-
* Defaults to `false`, where the error is simply logged.
|
|
611
|
-
* If set to `true`, the error is thrown.
|
|
612
|
-
* @see [NG8002](/errors/NG8002) for the description of the error and how to fix it
|
|
613
|
-
*/
|
|
614
|
-
errorOnUnknownProperties?: boolean;
|
|
615
|
-
/**
|
|
616
|
-
* Whether errors that happen during application change detection should be rethrown.
|
|
617
|
-
*
|
|
618
|
-
* When `true`, errors that are caught during application change detection will
|
|
619
|
-
* be reported to the `ErrorHandler` and rethrown to prevent them from going
|
|
620
|
-
* unnoticed in tests.
|
|
621
|
-
*
|
|
622
|
-
* When `false`, errors are only forwarded to the `ErrorHandler`, which by default
|
|
623
|
-
* simply logs them to the console.
|
|
624
|
-
*
|
|
625
|
-
* Defaults to `true`.
|
|
626
|
-
*/
|
|
627
|
-
rethrowApplicationErrors?: boolean;
|
|
628
|
-
/**
|
|
629
|
-
* Whether defer blocks should behave with manual triggering or play through normally.
|
|
630
|
-
* Defaults to `manual`.
|
|
631
|
-
*/
|
|
632
|
-
deferBlockBehavior?: DeferBlockBehavior;
|
|
498
|
+
declare class InjectSetupWrapper {
|
|
499
|
+
private _moduleDef;
|
|
500
|
+
constructor(_moduleDef: () => TestModuleMetadata);
|
|
501
|
+
private _addModule;
|
|
502
|
+
inject(tokens: any[], fn: Function): () => any;
|
|
633
503
|
}
|
|
634
|
-
|
|
635
504
|
/**
|
|
636
|
-
* Simulates the asynchronous passage of time for the timers in the `fakeAsync` zone.
|
|
637
|
-
*
|
|
638
|
-
* The microtasks queue is drained at the very start of this function and after any timer callback
|
|
639
|
-
* has been executed.
|
|
640
|
-
*
|
|
641
|
-
* @param millis The number of milliseconds to advance the virtual timer.
|
|
642
|
-
* @param tickOptions The options to pass to the `tick()` function.
|
|
643
|
-
*
|
|
644
|
-
* @usageNotes
|
|
645
|
-
*
|
|
646
|
-
* The `tick()` option is a flag called `processNewMacroTasksSynchronously`,
|
|
647
|
-
* which determines whether or not to invoke new macroTasks.
|
|
648
|
-
*
|
|
649
|
-
* If you provide a `tickOptions` object, but do not specify a
|
|
650
|
-
* `processNewMacroTasksSynchronously` property (`tick(100, {})`),
|
|
651
|
-
* then `processNewMacroTasksSynchronously` defaults to true.
|
|
652
|
-
*
|
|
653
|
-
* If you omit the `tickOptions` parameter (`tick(100))`), then
|
|
654
|
-
* `tickOptions` defaults to `{processNewMacroTasksSynchronously: true}`.
|
|
655
|
-
*
|
|
656
|
-
* ### Example
|
|
657
|
-
*
|
|
658
|
-
* {@example core/testing/ts/fake_async.ts region='basic'}
|
|
659
|
-
*
|
|
660
|
-
* The following example includes a nested timeout (new macroTask), and
|
|
661
|
-
* the `tickOptions` parameter is allowed to default. In this case,
|
|
662
|
-
* `processNewMacroTasksSynchronously` defaults to true, and the nested
|
|
663
|
-
* function is executed on each tick.
|
|
664
|
-
*
|
|
665
|
-
* ```ts
|
|
666
|
-
* it ('test with nested setTimeout', fakeAsync(() => {
|
|
667
|
-
* let nestedTimeoutInvoked = false;
|
|
668
|
-
* function funcWithNestedTimeout() {
|
|
669
|
-
* setTimeout(() => {
|
|
670
|
-
* nestedTimeoutInvoked = true;
|
|
671
|
-
* });
|
|
672
|
-
* };
|
|
673
|
-
* setTimeout(funcWithNestedTimeout);
|
|
674
|
-
* tick();
|
|
675
|
-
* expect(nestedTimeoutInvoked).toBe(true);
|
|
676
|
-
* }));
|
|
677
|
-
* ```
|
|
678
|
-
*
|
|
679
|
-
* In the following case, `processNewMacroTasksSynchronously` is explicitly
|
|
680
|
-
* set to false, so the nested timeout function is not invoked.
|
|
681
|
-
*
|
|
682
|
-
* ```ts
|
|
683
|
-
* it ('test with nested setTimeout', fakeAsync(() => {
|
|
684
|
-
* let nestedTimeoutInvoked = false;
|
|
685
|
-
* function funcWithNestedTimeout() {
|
|
686
|
-
* setTimeout(() => {
|
|
687
|
-
* nestedTimeoutInvoked = true;
|
|
688
|
-
* });
|
|
689
|
-
* };
|
|
690
|
-
* setTimeout(funcWithNestedTimeout);
|
|
691
|
-
* tick(0, {processNewMacroTasksSynchronously: false});
|
|
692
|
-
* expect(nestedTimeoutInvoked).toBe(false);
|
|
693
|
-
* }));
|
|
694
|
-
* ```
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
505
|
* @publicApi
|
|
698
506
|
*/
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}): void;
|
|
702
|
-
|
|
507
|
+
declare function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper;
|
|
508
|
+
declare function withModule(moduleDef: TestModuleMetadata, fn: Function): () => any;
|
|
703
509
|
|
|
704
510
|
/**
|
|
705
|
-
*
|
|
706
|
-
*
|
|
707
|
-
* to wrap an {@link inject} call.
|
|
708
|
-
*
|
|
709
|
-
* Example:
|
|
511
|
+
* This API should be removed. But doing so seems to break `google3` and so it requires a bit of
|
|
512
|
+
* investigation.
|
|
710
513
|
*
|
|
711
|
-
*
|
|
712
|
-
* it('...', waitForAsync(inject([AClass], (object) => {
|
|
713
|
-
* object.doSomething.then(() => {
|
|
714
|
-
* expect(...);
|
|
715
|
-
* })
|
|
716
|
-
* })));
|
|
717
|
-
* ```
|
|
514
|
+
* A work around is to mark it as `@codeGenApi` for now and investigate later.
|
|
718
515
|
*
|
|
719
|
-
* @
|
|
720
|
-
*/
|
|
721
|
-
export declare function waitForAsync(fn: Function): (done: any) => any;
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* @publicApi
|
|
516
|
+
* @codeGenApi
|
|
725
517
|
*/
|
|
726
|
-
|
|
518
|
+
declare const __core_private_testing_placeholder__ = "";
|
|
727
519
|
|
|
728
|
-
|
|
520
|
+
declare class MetadataOverrider {
|
|
521
|
+
private _references;
|
|
522
|
+
/**
|
|
523
|
+
* Creates a new instance for the given metadata class
|
|
524
|
+
* based on an old instance and overrides.
|
|
525
|
+
*/
|
|
526
|
+
overrideMetadata<C extends T, T>(metadataClass: {
|
|
527
|
+
new (options: T): C;
|
|
528
|
+
}, oldMetadata: C, override: MetadataOverride<T>): C;
|
|
529
|
+
}
|
|
729
530
|
|
|
730
531
|
/**
|
|
731
532
|
* Fake implementation of user agent history and navigation behavior. This is a
|
|
732
533
|
* high-fidelity implementation of browser behavior that attempts to emulate
|
|
733
534
|
* things like traversal delay.
|
|
734
535
|
*/
|
|
735
|
-
|
|
536
|
+
declare class FakeNavigation implements Navigation {
|
|
736
537
|
private readonly window;
|
|
737
538
|
/**
|
|
738
539
|
* The fake implementation of an entries array. Only same-document entries
|
|
@@ -863,16 +664,42 @@ export declare class ɵFakeNavigation implements Navigation {
|
|
|
863
664
|
updateCurrentEntry(_options: NavigationUpdateCurrentEntryOptions): void;
|
|
864
665
|
reload(_options?: NavigationReloadOptions): NavigationResult;
|
|
865
666
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
667
|
+
/**
|
|
668
|
+
* Fake equivalent of the `NavigationResult` interface with
|
|
669
|
+
* `FakeNavigationHistoryEntry`.
|
|
670
|
+
*/
|
|
671
|
+
interface FakeNavigationResult extends NavigationResult {
|
|
672
|
+
readonly committed: Promise<FakeNavigationHistoryEntry>;
|
|
673
|
+
readonly finished: Promise<FakeNavigationHistoryEntry>;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Fake equivalent of `NavigationHistoryEntry`.
|
|
677
|
+
*/
|
|
678
|
+
declare class FakeNavigationHistoryEntry implements NavigationHistoryEntry {
|
|
679
|
+
private eventTarget;
|
|
680
|
+
readonly url: string | null;
|
|
681
|
+
readonly sameDocument: boolean;
|
|
682
|
+
readonly id: string;
|
|
683
|
+
readonly key: string;
|
|
684
|
+
readonly index: number;
|
|
685
|
+
private readonly state;
|
|
686
|
+
private readonly historyState;
|
|
687
|
+
ondispose: ((this: NavigationHistoryEntry, ev: Event) => any) | null;
|
|
688
|
+
constructor(eventTarget: EventTarget, url: string | null, { id, key, index, sameDocument, state, historyState, }: {
|
|
689
|
+
id: string;
|
|
690
|
+
key: string;
|
|
691
|
+
index: number;
|
|
692
|
+
sameDocument: boolean;
|
|
693
|
+
historyState: unknown;
|
|
694
|
+
state?: unknown;
|
|
695
|
+
});
|
|
696
|
+
getState(): unknown;
|
|
697
|
+
getHistoryState(): unknown;
|
|
698
|
+
addEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: AddEventListenerOptions | boolean): void;
|
|
699
|
+
removeEventListener(type: string, callback: EventListenerOrEventListenerObject, options?: EventListenerOptions | boolean): void;
|
|
700
|
+
dispatchEvent(event: Event): boolean;
|
|
701
|
+
/** internal */
|
|
702
|
+
dispose(): void;
|
|
876
703
|
}
|
|
877
704
|
|
|
878
|
-
export { }
|
|
705
|
+
export { ComponentFixture, ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, DeferBlockFixture, InjectSetupWrapper, type MetadataOverride, type ModuleTeardownOptions, TestBed, type TestBedStatic, TestComponentRenderer, type TestEnvironmentOptions, type TestModuleMetadata, __core_private_testing_placeholder__, discardPeriodicTasks, fakeAsync, flush, flushMicrotasks, getTestBed, inject, resetFakeAsyncZone, tick, waitForAsync, withModule, FakeNavigation as ɵFakeNavigation, MetadataOverrider as ɵMetadataOverrider };
|