@angular/core 14.0.0-next.9 → 14.0.0-rc.0
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/esm2020/src/application_ref.mjs +232 -66
- package/esm2020/src/application_tokens.mjs +5 -2
- package/esm2020/src/change_detection/change_detection.mjs +2 -2
- package/esm2020/src/change_detection/change_detector_ref.mjs +3 -3
- package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +3 -3
- package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +3 -3
- package/esm2020/src/change_detection/differs/iterable_differs.mjs +2 -2
- package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +2 -2
- package/esm2020/src/compiler/compiler_facade.mjs +2 -2
- package/esm2020/src/compiler/compiler_facade_interface.mjs +7 -1
- package/esm2020/src/console.mjs +4 -3
- package/esm2020/src/core.mjs +2 -2
- package/esm2020/src/core_private_export.mjs +5 -3
- package/esm2020/src/core_render3_private_export.mjs +4 -3
- package/esm2020/src/debug/debug_node.mjs +5 -5
- package/esm2020/src/di/create_injector.mjs +35 -0
- package/esm2020/src/di/index.mjs +4 -1
- package/esm2020/src/di/initializer_token.mjs +16 -0
- package/esm2020/src/di/injection_token.mjs +7 -1
- package/esm2020/src/di/injector.mjs +3 -3
- package/esm2020/src/di/injector_compatibility.mjs +4 -6
- package/esm2020/src/di/injector_token.mjs +2 -2
- package/esm2020/src/di/interface/defs.mjs +1 -1
- package/esm2020/src/di/interface/provider.mjs +1 -1
- package/esm2020/src/di/internal_tokens.mjs +10 -0
- package/esm2020/src/di/jit/injectable.mjs +3 -3
- package/esm2020/src/di/metadata.mjs +6 -6
- package/esm2020/src/di/provider_collection.mjs +224 -0
- package/esm2020/src/di/r3_injector.mjs +87 -157
- package/esm2020/src/di/scope.mjs +1 -1
- package/esm2020/src/errors.mjs +1 -1
- package/esm2020/src/linker/component_factory.mjs +1 -1
- package/esm2020/src/linker/ng_module_factory.mjs +1 -1
- package/esm2020/src/linker/template_ref.mjs +3 -3
- package/esm2020/src/linker/view_container_ref.mjs +15 -12
- package/esm2020/src/metadata/directives.mjs +1 -1
- package/esm2020/src/metadata/ng_module.mjs +1 -1
- package/esm2020/src/metadata.mjs +1 -1
- package/esm2020/src/platform_core_providers.mjs +3 -14
- package/esm2020/src/render3/assert.mjs +3 -3
- package/esm2020/src/render3/bindings.mjs +2 -2
- package/esm2020/src/render3/collect_native_nodes.mjs +5 -5
- package/esm2020/src/render3/component.mjs +8 -8
- package/esm2020/src/render3/component_ref.mjs +15 -7
- package/esm2020/src/render3/context_discovery.mjs +4 -4
- package/esm2020/src/render3/definition.mjs +18 -20
- package/esm2020/src/render3/di.mjs +21 -21
- package/esm2020/src/render3/di_setup.mjs +7 -6
- package/esm2020/src/render3/errors.mjs +22 -4
- package/esm2020/src/render3/errors_di.mjs +10 -7
- package/esm2020/src/render3/features/inherit_definition_feature.mjs +4 -3
- package/esm2020/src/render3/features/standalone_feature.mjs +70 -0
- package/esm2020/src/render3/hooks.mjs +19 -19
- package/esm2020/src/render3/i18n/i18n_apply.mjs +16 -16
- package/esm2020/src/render3/i18n/i18n_debug.mjs +9 -9
- package/esm2020/src/render3/i18n/i18n_insert_before_index.mjs +2 -2
- package/esm2020/src/render3/i18n/i18n_parse.mjs +14 -14
- package/esm2020/src/render3/i18n/i18n_util.mjs +7 -7
- package/esm2020/src/render3/index.mjs +5 -4
- package/esm2020/src/render3/instructions/advance.mjs +4 -4
- package/esm2020/src/render3/instructions/all.mjs +2 -1
- package/esm2020/src/render3/instructions/change_detection.mjs +2 -2
- package/esm2020/src/render3/instructions/element.mjs +47 -12
- package/esm2020/src/render3/instructions/element_container.mjs +3 -3
- package/esm2020/src/render3/instructions/i18n.mjs +2 -2
- package/esm2020/src/render3/instructions/listener.mjs +8 -11
- package/esm2020/src/render3/instructions/lview_debug.mjs +26 -26
- package/esm2020/src/render3/instructions/projection.mjs +3 -3
- package/esm2020/src/render3/instructions/shared.mjs +133 -87
- package/esm2020/src/render3/instructions/styling.mjs +5 -5
- package/esm2020/src/render3/instructions/template.mjs +3 -3
- package/esm2020/src/render3/instructions/text.mjs +2 -2
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/interfaces/node.mjs +10 -10
- package/esm2020/src/render3/interfaces/public_definitions.mjs +1 -1
- package/esm2020/src/render3/interfaces/styling.mjs +18 -18
- package/esm2020/src/render3/interfaces/type_checks.mjs +5 -5
- package/esm2020/src/render3/interfaces/view.mjs +1 -1
- package/esm2020/src/render3/jit/directive.mjs +135 -13
- package/esm2020/src/render3/jit/environment.mjs +2 -1
- package/esm2020/src/render3/jit/module.mjs +84 -27
- package/esm2020/src/render3/jit/partial.mjs +8 -8
- package/esm2020/src/render3/jit/pipe.mjs +4 -6
- package/esm2020/src/render3/jit/util.mjs +15 -0
- package/esm2020/src/render3/ng_module_ref.mjs +34 -4
- package/esm2020/src/render3/node_assert.mjs +8 -8
- package/esm2020/src/render3/node_manipulation.mjs +40 -40
- package/esm2020/src/render3/node_manipulation_i18n.mjs +3 -3
- package/esm2020/src/render3/node_selector_matcher.mjs +28 -28
- package/esm2020/src/render3/pipe.mjs +2 -2
- package/esm2020/src/render3/query.mjs +12 -12
- package/esm2020/src/render3/state.mjs +21 -10
- package/esm2020/src/render3/styling/class_differ.mjs +3 -3
- package/esm2020/src/render3/styling/static_styling.mjs +3 -3
- package/esm2020/src/render3/styling/styling_parser.mjs +17 -17
- package/esm2020/src/render3/util/attrs_utils.mjs +10 -10
- package/esm2020/src/render3/util/discovery_utils.mjs +4 -4
- package/esm2020/src/render3/util/injector_utils.mjs +4 -4
- package/esm2020/src/render3/util/view_traversal_utils.mjs +2 -2
- package/esm2020/src/render3/util/view_utils.mjs +3 -3
- package/esm2020/src/render3/view_ref.mjs +12 -8
- package/esm2020/src/sanitization/bypass.mjs +7 -7
- package/esm2020/src/sanitization/sanitization.mjs +10 -10
- package/esm2020/src/testability/testability.mjs +69 -19
- package/esm2020/src/util/global.mjs +8 -8
- package/esm2020/src/util/raf.mjs +1 -1
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/esm2020/testing/src/r3_test_bed.mjs +38 -13
- package/esm2020/testing/src/r3_test_bed_compiler.mjs +45 -4
- package/esm2020/testing/src/resolvers.mjs +1 -1
- package/esm2020/testing/src/test_bed.mjs +1 -1
- package/esm2020/testing/src/test_bed_common.mjs +5 -1
- package/fesm2015/core.mjs +1785 -942
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +88 -15
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +1780 -943
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +85 -15
- package/fesm2020/testing.mjs.map +1 -1
- package/{core.d.ts → index.d.ts} +14774 -14596
- package/package.json +4 -4
- package/schematics/migrations/path-match-type/index.d.ts +11 -0
- package/schematics/migrations/path-match-type/index.js +95 -0
- package/schematics/migrations/path-match-type/transform.d.ts +19 -0
- package/schematics/migrations/path-match-type/transform.js +48 -0
- package/schematics/migrations/path-match-type/update_recorder.d.ts +18 -0
- package/schematics/migrations/path-match-type/update_recorder.js +20 -0
- package/schematics/migrations/path-match-type/util.d.ts +11 -0
- package/schematics/migrations/path-match-type/util.js +106 -0
- package/schematics/migrations.json +8 -3
- package/testing/{testing.d.ts → index.d.ts} +565 -577
- package/esm2020/src/change_detection/change_detection_util.mjs +0 -64
- package/testing/package.json +0 -9
|
@@ -1,582 +1,570 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-
|
|
2
|
+
* @license Angular v14.0.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
* @
|
|
36
|
-
* @
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
private
|
|
71
|
-
private
|
|
72
|
-
private
|
|
73
|
-
private
|
|
74
|
-
private
|
|
75
|
-
private
|
|
76
|
-
private
|
|
77
|
-
private
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* asynchronous
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
*
|
|
137
|
-
* -
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* function
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
* the
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
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
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
*
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
*
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
*
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
/**
|
|
373
|
-
*
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
* @
|
|
453
|
-
*/
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
*
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
*
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
* `processNewMacroTasksSynchronously`
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
506
|
-
* ```
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
*
|
|
522
|
-
*
|
|
523
|
-
* ```
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
*
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
*
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
export declare class ɵMetadataOverrider {
|
|
572
|
-
private _references;
|
|
573
|
-
/**
|
|
574
|
-
* Creates a new instance for the given metadata class
|
|
575
|
-
* based on an old instance and overrides.
|
|
576
|
-
*/
|
|
577
|
-
overrideMetadata<C extends T, T>(metadataClass: {
|
|
578
|
-
new (options: T): C;
|
|
579
|
-
}, oldMetadata: C, override: MetadataOverride<T>): C;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
export { }
|
|
7
|
+
|
|
8
|
+
import { ChangeDetectorRef } from '@angular/core';
|
|
9
|
+
import { Component } from '@angular/core';
|
|
10
|
+
import { ComponentRef } from '@angular/core';
|
|
11
|
+
import { DebugElement } from '@angular/core';
|
|
12
|
+
import { Directive } from '@angular/core';
|
|
13
|
+
import { ElementRef } from '@angular/core';
|
|
14
|
+
import { InjectFlags } from '@angular/core';
|
|
15
|
+
import { InjectionToken } from '@angular/core';
|
|
16
|
+
import { NgModule } from '@angular/core';
|
|
17
|
+
import { NgZone } from '@angular/core';
|
|
18
|
+
import { Pipe } from '@angular/core';
|
|
19
|
+
import { PlatformRef } from '@angular/core';
|
|
20
|
+
import { ProviderToken } from '@angular/core';
|
|
21
|
+
import { SchemaMetadata } from '@angular/core';
|
|
22
|
+
import { Type } from '@angular/core';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* This API should be removed. But doing so seems to break `google3` and so it requires a bit of
|
|
26
|
+
* investigation.
|
|
27
|
+
*
|
|
28
|
+
* A work around is to mark it as `@codeGenApi` for now and investigate later.
|
|
29
|
+
*
|
|
30
|
+
* @codeGenApi
|
|
31
|
+
*/
|
|
32
|
+
export declare const __core_private_testing_placeholder__ = "";
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated use `waitForAsync()`, (expected removal in v12)
|
|
36
|
+
* @see {@link waitForAsync}
|
|
37
|
+
* @publicApi
|
|
38
|
+
* */
|
|
39
|
+
export declare function async(fn: Function): (done: any) => any;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Fixture for debugging and testing a component.
|
|
43
|
+
*
|
|
44
|
+
* @publicApi
|
|
45
|
+
*/
|
|
46
|
+
export declare class ComponentFixture<T> {
|
|
47
|
+
componentRef: ComponentRef<T>;
|
|
48
|
+
ngZone: NgZone | null;
|
|
49
|
+
private _autoDetect;
|
|
50
|
+
/**
|
|
51
|
+
* The DebugElement associated with the root element of this component.
|
|
52
|
+
*/
|
|
53
|
+
debugElement: DebugElement;
|
|
54
|
+
/**
|
|
55
|
+
* The instance of the root component class.
|
|
56
|
+
*/
|
|
57
|
+
componentInstance: T;
|
|
58
|
+
/**
|
|
59
|
+
* The native element at the root of the component.
|
|
60
|
+
*/
|
|
61
|
+
nativeElement: any;
|
|
62
|
+
/**
|
|
63
|
+
* The ElementRef for the element at the root of the component.
|
|
64
|
+
*/
|
|
65
|
+
elementRef: ElementRef;
|
|
66
|
+
/**
|
|
67
|
+
* The ChangeDetectorRef for the component
|
|
68
|
+
*/
|
|
69
|
+
changeDetectorRef: ChangeDetectorRef;
|
|
70
|
+
private _renderer;
|
|
71
|
+
private _isStable;
|
|
72
|
+
private _isDestroyed;
|
|
73
|
+
private _resolve;
|
|
74
|
+
private _promise;
|
|
75
|
+
private _onUnstableSubscription;
|
|
76
|
+
private _onStableSubscription;
|
|
77
|
+
private _onMicrotaskEmptySubscription;
|
|
78
|
+
private _onErrorSubscription;
|
|
79
|
+
constructor(componentRef: ComponentRef<T>, ngZone: NgZone | null, _autoDetect: boolean);
|
|
80
|
+
private _tick;
|
|
81
|
+
/**
|
|
82
|
+
* Trigger a change detection cycle for the component.
|
|
83
|
+
*/
|
|
84
|
+
detectChanges(checkNoChanges?: boolean): void;
|
|
85
|
+
/**
|
|
86
|
+
* Do a change detection run to make sure there were no changes.
|
|
87
|
+
*/
|
|
88
|
+
checkNoChanges(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Set whether the fixture should autodetect changes.
|
|
91
|
+
*
|
|
92
|
+
* Also runs detectChanges once so that any existing change is detected.
|
|
93
|
+
*/
|
|
94
|
+
autoDetectChanges(autoDetect?: boolean): void;
|
|
95
|
+
/**
|
|
96
|
+
* Return whether the fixture is currently stable or has async tasks that have not been completed
|
|
97
|
+
* yet.
|
|
98
|
+
*/
|
|
99
|
+
isStable(): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Get a promise that resolves when the fixture is stable.
|
|
102
|
+
*
|
|
103
|
+
* This can be used to resume testing after events have triggered asynchronous activity or
|
|
104
|
+
* asynchronous change detection.
|
|
105
|
+
*/
|
|
106
|
+
whenStable(): Promise<any>;
|
|
107
|
+
private _getRenderer;
|
|
108
|
+
/**
|
|
109
|
+
* Get a promise that resolves when the ui state is stable following animations.
|
|
110
|
+
*/
|
|
111
|
+
whenRenderingDone(): Promise<any>;
|
|
112
|
+
/**
|
|
113
|
+
* Trigger component destruction.
|
|
114
|
+
*/
|
|
115
|
+
destroy(): void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @publicApi
|
|
120
|
+
*/
|
|
121
|
+
export declare const ComponentFixtureAutoDetect: InjectionToken<boolean[]>;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @publicApi
|
|
125
|
+
*/
|
|
126
|
+
export declare const ComponentFixtureNoNgZone: InjectionToken<boolean[]>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Discard all remaining periodic tasks.
|
|
130
|
+
*
|
|
131
|
+
* @publicApi
|
|
132
|
+
*/
|
|
133
|
+
export declare function discardPeriodicTasks(): void;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Wraps a function to be executed in the `fakeAsync` zone:
|
|
137
|
+
* - Microtasks are manually executed by calling `flushMicrotasks()`.
|
|
138
|
+
* - Timers are synchronous; `tick()` simulates the asynchronous passage of time.
|
|
139
|
+
*
|
|
140
|
+
* If there are any pending timers at the end of the function, an exception is thrown.
|
|
141
|
+
*
|
|
142
|
+
* Can be used to wrap `inject()` calls.
|
|
143
|
+
*
|
|
144
|
+
* @param fn The function that you want to wrap in the `fakeAysnc` zone.
|
|
145
|
+
*
|
|
146
|
+
* @usageNotes
|
|
147
|
+
* ### Example
|
|
148
|
+
*
|
|
149
|
+
* {@example core/testing/ts/fake_async.ts region='basic'}
|
|
150
|
+
*
|
|
151
|
+
*
|
|
152
|
+
* @returns The function wrapped to be executed in the `fakeAsync` zone.
|
|
153
|
+
* Any arguments passed when calling this returned function will be passed through to the `fn`
|
|
154
|
+
* function in the parameters when it is called.
|
|
155
|
+
*
|
|
156
|
+
* @publicApi
|
|
157
|
+
*/
|
|
158
|
+
export declare function fakeAsync(fn: Function): (...args: any[]) => any;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Flushes any pending microtasks and simulates the asynchronous passage of time for the timers in
|
|
162
|
+
* the `fakeAsync` zone by
|
|
163
|
+
* draining the macrotask queue until it is empty.
|
|
164
|
+
*
|
|
165
|
+
* @param maxTurns The maximum number of times the scheduler attempts to clear its queue before
|
|
166
|
+
* throwing an error.
|
|
167
|
+
* @returns The simulated time elapsed, in milliseconds.
|
|
168
|
+
*
|
|
169
|
+
* @publicApi
|
|
170
|
+
*/
|
|
171
|
+
export declare function flush(maxTurns?: number): number;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Flush any pending microtasks.
|
|
175
|
+
*
|
|
176
|
+
* @publicApi
|
|
177
|
+
*/
|
|
178
|
+
export declare function flushMicrotasks(): void;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Returns a singleton of the applicable `TestBed`.
|
|
182
|
+
*
|
|
183
|
+
* It will be either an instance of `TestBedViewEngine` or `TestBedRender3`.
|
|
184
|
+
*
|
|
185
|
+
* @publicApi
|
|
186
|
+
*/
|
|
187
|
+
export declare const getTestBed: () => TestBed;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Allows injecting dependencies in `beforeEach()` and `it()`.
|
|
191
|
+
*
|
|
192
|
+
* Example:
|
|
193
|
+
*
|
|
194
|
+
* ```
|
|
195
|
+
* beforeEach(inject([Dependency, AClass], (dep, object) => {
|
|
196
|
+
* // some code that uses `dep` and `object`
|
|
197
|
+
* // ...
|
|
198
|
+
* }));
|
|
199
|
+
*
|
|
200
|
+
* it('...', inject([AClass], (object) => {
|
|
201
|
+
* object.doSomething();
|
|
202
|
+
* expect(...);
|
|
203
|
+
* })
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @publicApi
|
|
207
|
+
*/
|
|
208
|
+
export declare function inject(tokens: any[], fn: Function): () => any;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @publicApi
|
|
212
|
+
*/
|
|
213
|
+
export declare class InjectSetupWrapper {
|
|
214
|
+
private _moduleDef;
|
|
215
|
+
constructor(_moduleDef: () => TestModuleMetadata);
|
|
216
|
+
private _addModule;
|
|
217
|
+
inject(tokens: any[], fn: Function): () => any;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Type used for modifications to metadata
|
|
223
|
+
*
|
|
224
|
+
* @publicApi
|
|
225
|
+
*/
|
|
226
|
+
export declare type MetadataOverride<T> = {
|
|
227
|
+
add?: Partial<T>;
|
|
228
|
+
remove?: Partial<T>;
|
|
229
|
+
set?: Partial<T>;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Configures the test module teardown behavior in `TestBed`.
|
|
234
|
+
* @publicApi
|
|
235
|
+
*/
|
|
236
|
+
export declare interface ModuleTeardownOptions {
|
|
237
|
+
/** Whether the test module should be destroyed after every test. */
|
|
238
|
+
destroyAfterEach: boolean;
|
|
239
|
+
/** Whether errors during test module destruction should be re-thrown. Defaults to `true`. */
|
|
240
|
+
rethrowErrors?: boolean;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Clears out the shared fake async zone for a test.
|
|
245
|
+
* To be called in a global `beforeEach`.
|
|
246
|
+
*
|
|
247
|
+
* @publicApi
|
|
248
|
+
*/
|
|
249
|
+
export declare function resetFakeAsyncZone(): void;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @publicApi
|
|
253
|
+
*/
|
|
254
|
+
export declare interface TestBed {
|
|
255
|
+
platform: PlatformRef;
|
|
256
|
+
ngModule: Type<any> | Type<any>[];
|
|
257
|
+
/**
|
|
258
|
+
* Initialize the environment for testing with a compiler factory, a PlatformRef, and an
|
|
259
|
+
* angular module. These are common to every test in the suite.
|
|
260
|
+
*
|
|
261
|
+
* This may only be called once, to set up the common providers for the current test
|
|
262
|
+
* suite on the current platform. If you absolutely need to change the providers,
|
|
263
|
+
* first use `resetTestEnvironment`.
|
|
264
|
+
*
|
|
265
|
+
* Test modules and platforms for individual platforms are available from
|
|
266
|
+
* '@angular/<platform_name>/testing'.
|
|
267
|
+
*/
|
|
268
|
+
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: TestEnvironmentOptions): void;
|
|
269
|
+
/**
|
|
270
|
+
* Reset the providers for the test injector.
|
|
271
|
+
*/
|
|
272
|
+
resetTestEnvironment(): void;
|
|
273
|
+
resetTestingModule(): void;
|
|
274
|
+
configureCompiler(config: {
|
|
275
|
+
providers?: any[];
|
|
276
|
+
useJit?: boolean;
|
|
277
|
+
}): void;
|
|
278
|
+
configureTestingModule(moduleDef: TestModuleMetadata): void;
|
|
279
|
+
compileComponents(): Promise<any>;
|
|
280
|
+
inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
|
281
|
+
inject<T>(token: ProviderToken<T>, notFoundValue: null, flags?: InjectFlags): T | null;
|
|
282
|
+
/** @deprecated from v9.0.0 use TestBed.inject */
|
|
283
|
+
get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
|
284
|
+
/** @deprecated from v9.0.0 use TestBed.inject */
|
|
285
|
+
get(token: any, notFoundValue?: any): any;
|
|
286
|
+
execute(tokens: any[], fn: Function, context?: any): any;
|
|
287
|
+
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModule>): void;
|
|
288
|
+
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): void;
|
|
289
|
+
overrideDirective(directive: Type<any>, override: MetadataOverride<Directive>): void;
|
|
290
|
+
overridePipe(pipe: Type<any>, override: MetadataOverride<Pipe>): void;
|
|
291
|
+
/**
|
|
292
|
+
* Overwrites all providers for the given token with the given provider definition.
|
|
293
|
+
*/
|
|
294
|
+
overrideProvider(token: any, provider: {
|
|
295
|
+
useFactory: Function;
|
|
296
|
+
deps: any[];
|
|
297
|
+
}): void;
|
|
298
|
+
overrideProvider(token: any, provider: {
|
|
299
|
+
useValue: any;
|
|
300
|
+
}): void;
|
|
301
|
+
overrideProvider(token: any, provider: {
|
|
302
|
+
useFactory?: Function;
|
|
303
|
+
useValue?: any;
|
|
304
|
+
deps?: any[];
|
|
305
|
+
}): void;
|
|
306
|
+
overrideTemplateUsingTestingModule(component: Type<any>, template: string): void;
|
|
307
|
+
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @description
|
|
312
|
+
* Configures and initializes environment for unit testing and provides methods for
|
|
313
|
+
* creating components and services in unit tests.
|
|
314
|
+
*
|
|
315
|
+
* `TestBed` is the primary api for writing unit tests for Angular applications and libraries.
|
|
316
|
+
*
|
|
317
|
+
* Note: Use `TestBed` in tests. It will be set to either `TestBedViewEngine` or `TestBedRender3`
|
|
318
|
+
* according to the compiler used.
|
|
319
|
+
*
|
|
320
|
+
* @publicApi
|
|
321
|
+
*/
|
|
322
|
+
export declare const TestBed: TestBedStatic;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Static methods implemented by the `TestBedViewEngine` and `TestBedRender3`
|
|
326
|
+
*
|
|
327
|
+
* @publicApi
|
|
328
|
+
*/
|
|
329
|
+
export declare interface TestBedStatic {
|
|
330
|
+
new (...args: any[]): TestBed;
|
|
331
|
+
/**
|
|
332
|
+
* Initialize the environment for testing with a compiler factory, a PlatformRef, and an
|
|
333
|
+
* angular module. These are common to every test in the suite.
|
|
334
|
+
*
|
|
335
|
+
* This may only be called once, to set up the common providers for the current test
|
|
336
|
+
* suite on the current platform. If you absolutely need to change the providers,
|
|
337
|
+
* first use `resetTestEnvironment`.
|
|
338
|
+
*
|
|
339
|
+
* Test modules and platforms for individual platforms are available from
|
|
340
|
+
* '@angular/<platform_name>/testing'.
|
|
341
|
+
*/
|
|
342
|
+
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: TestEnvironmentOptions): TestBed;
|
|
343
|
+
/**
|
|
344
|
+
* Reset the providers for the test injector.
|
|
345
|
+
*/
|
|
346
|
+
resetTestEnvironment(): void;
|
|
347
|
+
resetTestingModule(): TestBedStatic;
|
|
348
|
+
/**
|
|
349
|
+
* Allows overriding default compiler providers and settings
|
|
350
|
+
* which are defined in test_injector.js
|
|
351
|
+
*/
|
|
352
|
+
configureCompiler(config: {
|
|
353
|
+
providers?: any[];
|
|
354
|
+
useJit?: boolean;
|
|
355
|
+
}): TestBedStatic;
|
|
356
|
+
/**
|
|
357
|
+
* Allows overriding default providers, directives, pipes, modules of the test injector,
|
|
358
|
+
* which are defined in test_injector.js
|
|
359
|
+
*/
|
|
360
|
+
configureTestingModule(moduleDef: TestModuleMetadata): TestBedStatic;
|
|
361
|
+
/**
|
|
362
|
+
* Compile components with a `templateUrl` for the test's NgModule.
|
|
363
|
+
* It is necessary to call this function
|
|
364
|
+
* as fetching urls is asynchronous.
|
|
365
|
+
*/
|
|
366
|
+
compileComponents(): Promise<any>;
|
|
367
|
+
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModule>): TestBedStatic;
|
|
368
|
+
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): TestBedStatic;
|
|
369
|
+
overrideDirective(directive: Type<any>, override: MetadataOverride<Directive>): TestBedStatic;
|
|
370
|
+
overridePipe(pipe: Type<any>, override: MetadataOverride<Pipe>): TestBedStatic;
|
|
371
|
+
overrideTemplate(component: Type<any>, template: string): TestBedStatic;
|
|
372
|
+
/**
|
|
373
|
+
* Overrides the template of the given component, compiling the template
|
|
374
|
+
* in the context of the TestingModule.
|
|
375
|
+
*
|
|
376
|
+
* Note: This works for JIT and AOTed components as well.
|
|
377
|
+
*/
|
|
378
|
+
overrideTemplateUsingTestingModule(component: Type<any>, template: string): TestBedStatic;
|
|
379
|
+
/**
|
|
380
|
+
* Overwrites all providers for the given token with the given provider definition.
|
|
381
|
+
*
|
|
382
|
+
* Note: This works for JIT and AOTed components as well.
|
|
383
|
+
*/
|
|
384
|
+
overrideProvider(token: any, provider: {
|
|
385
|
+
useFactory: Function;
|
|
386
|
+
deps: any[];
|
|
387
|
+
}): TestBedStatic;
|
|
388
|
+
overrideProvider(token: any, provider: {
|
|
389
|
+
useValue: any;
|
|
390
|
+
}): TestBedStatic;
|
|
391
|
+
overrideProvider(token: any, provider: {
|
|
392
|
+
useFactory?: Function;
|
|
393
|
+
useValue?: any;
|
|
394
|
+
deps?: any[];
|
|
395
|
+
}): TestBedStatic;
|
|
396
|
+
inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
|
|
397
|
+
inject<T>(token: ProviderToken<T>, notFoundValue: null, flags?: InjectFlags): T | null;
|
|
398
|
+
/** @deprecated from v9.0.0 use TestBed.inject */
|
|
399
|
+
get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
|
|
400
|
+
/** @deprecated from v9.0.0 use TestBed.inject */
|
|
401
|
+
get(token: any, notFoundValue?: any): any;
|
|
402
|
+
createComponent<T>(component: Type<T>): ComponentFixture<T>;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* An abstract class for inserting the root test component element in a platform independent way.
|
|
407
|
+
*
|
|
408
|
+
* @publicApi
|
|
409
|
+
*/
|
|
410
|
+
export declare class TestComponentRenderer {
|
|
411
|
+
insertRootElement(rootElementId: string): void;
|
|
412
|
+
removeAllRootElements?(): void;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @publicApi
|
|
417
|
+
*/
|
|
418
|
+
export declare interface TestEnvironmentOptions {
|
|
419
|
+
/**
|
|
420
|
+
* Configures the test module teardown behavior in `TestBed`.
|
|
421
|
+
*/
|
|
422
|
+
teardown?: ModuleTeardownOptions;
|
|
423
|
+
/**
|
|
424
|
+
* Whether errors should be thrown when unknown elements are present in component's template.
|
|
425
|
+
* Defaults to `false`, where the error is simply logged.
|
|
426
|
+
* If set to `true`, the error is thrown.
|
|
427
|
+
* @see https://angular.io/errors/NG8001 for the description of the error and how to fix it
|
|
428
|
+
*/
|
|
429
|
+
errorOnUnknownElements?: boolean;
|
|
430
|
+
/**
|
|
431
|
+
* Whether errors should be thrown when unknown properties are present in component's template.
|
|
432
|
+
* Defaults to `false`, where the error is simply logged.
|
|
433
|
+
* If set to `true`, the error is thrown.
|
|
434
|
+
* @see https://angular.io/errors/NG8002 for the description of the error and how to fix it
|
|
435
|
+
*/
|
|
436
|
+
errorOnUnknownProperties?: boolean;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @publicApi
|
|
441
|
+
*/
|
|
442
|
+
export declare interface TestModuleMetadata {
|
|
443
|
+
providers?: any[];
|
|
444
|
+
declarations?: any[];
|
|
445
|
+
imports?: any[];
|
|
446
|
+
schemas?: Array<SchemaMetadata | any[]>;
|
|
447
|
+
teardown?: ModuleTeardownOptions;
|
|
448
|
+
/**
|
|
449
|
+
* Whether NG0304 runtime errors should be thrown when unknown elements are present in component's
|
|
450
|
+
* template. Defaults to `false`, where the error is simply logged. If set to `true`, the error is
|
|
451
|
+
* thrown.
|
|
452
|
+
* @see https://angular.io/errors/NG8001 for the description of the problem and how to fix it
|
|
453
|
+
*/
|
|
454
|
+
errorOnUnknownElements?: boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Whether errors should be thrown when unknown properties are present in component's template.
|
|
457
|
+
* Defaults to `false`, where the error is simply logged.
|
|
458
|
+
* If set to `true`, the error is thrown.
|
|
459
|
+
* @see https://angular.io/errors/NG8002 for the description of the error and how to fix it
|
|
460
|
+
*/
|
|
461
|
+
errorOnUnknownProperties?: boolean;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Simulates the asynchronous passage of time for the timers in the `fakeAsync` zone.
|
|
466
|
+
*
|
|
467
|
+
* The microtasks queue is drained at the very start of this function and after any timer callback
|
|
468
|
+
* has been executed.
|
|
469
|
+
*
|
|
470
|
+
* @param millis The number of milliseconds to advance the virtual timer.
|
|
471
|
+
* @param tickOptions The options to pass to the `tick()` function.
|
|
472
|
+
*
|
|
473
|
+
* @usageNotes
|
|
474
|
+
*
|
|
475
|
+
* The `tick()` option is a flag called `processNewMacroTasksSynchronously`,
|
|
476
|
+
* which determines whether or not to invoke new macroTasks.
|
|
477
|
+
*
|
|
478
|
+
* If you provide a `tickOptions` object, but do not specify a
|
|
479
|
+
* `processNewMacroTasksSynchronously` property (`tick(100, {})`),
|
|
480
|
+
* then `processNewMacroTasksSynchronously` defaults to true.
|
|
481
|
+
*
|
|
482
|
+
* If you omit the `tickOptions` parameter (`tick(100))`), then
|
|
483
|
+
* `tickOptions` defaults to `{processNewMacroTasksSynchronously: true}`.
|
|
484
|
+
*
|
|
485
|
+
* ### Example
|
|
486
|
+
*
|
|
487
|
+
* {@example core/testing/ts/fake_async.ts region='basic'}
|
|
488
|
+
*
|
|
489
|
+
* The following example includes a nested timeout (new macroTask), and
|
|
490
|
+
* the `tickOptions` parameter is allowed to default. In this case,
|
|
491
|
+
* `processNewMacroTasksSynchronously` defaults to true, and the nested
|
|
492
|
+
* function is executed on each tick.
|
|
493
|
+
*
|
|
494
|
+
* ```
|
|
495
|
+
* it ('test with nested setTimeout', fakeAsync(() => {
|
|
496
|
+
* let nestedTimeoutInvoked = false;
|
|
497
|
+
* function funcWithNestedTimeout() {
|
|
498
|
+
* setTimeout(() => {
|
|
499
|
+
* nestedTimeoutInvoked = true;
|
|
500
|
+
* });
|
|
501
|
+
* };
|
|
502
|
+
* setTimeout(funcWithNestedTimeout);
|
|
503
|
+
* tick();
|
|
504
|
+
* expect(nestedTimeoutInvoked).toBe(true);
|
|
505
|
+
* }));
|
|
506
|
+
* ```
|
|
507
|
+
*
|
|
508
|
+
* In the following case, `processNewMacroTasksSynchronously` is explicitly
|
|
509
|
+
* set to false, so the nested timeout function is not invoked.
|
|
510
|
+
*
|
|
511
|
+
* ```
|
|
512
|
+
* it ('test with nested setTimeout', fakeAsync(() => {
|
|
513
|
+
* let nestedTimeoutInvoked = false;
|
|
514
|
+
* function funcWithNestedTimeout() {
|
|
515
|
+
* setTimeout(() => {
|
|
516
|
+
* nestedTimeoutInvoked = true;
|
|
517
|
+
* });
|
|
518
|
+
* };
|
|
519
|
+
* setTimeout(funcWithNestedTimeout);
|
|
520
|
+
* tick(0, {processNewMacroTasksSynchronously: false});
|
|
521
|
+
* expect(nestedTimeoutInvoked).toBe(false);
|
|
522
|
+
* }));
|
|
523
|
+
* ```
|
|
524
|
+
*
|
|
525
|
+
*
|
|
526
|
+
* @publicApi
|
|
527
|
+
*/
|
|
528
|
+
export declare function tick(millis?: number, tickOptions?: {
|
|
529
|
+
processNewMacroTasksSynchronously: boolean;
|
|
530
|
+
}): void;
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Wraps a test function in an asynchronous test zone. The test will automatically
|
|
535
|
+
* complete when all asynchronous calls within this zone are done. Can be used
|
|
536
|
+
* to wrap an {@link inject} call.
|
|
537
|
+
*
|
|
538
|
+
* Example:
|
|
539
|
+
*
|
|
540
|
+
* ```
|
|
541
|
+
* it('...', waitForAsync(inject([AClass], (object) => {
|
|
542
|
+
* object.doSomething.then(() => {
|
|
543
|
+
* expect(...);
|
|
544
|
+
* })
|
|
545
|
+
* });
|
|
546
|
+
* ```
|
|
547
|
+
*
|
|
548
|
+
* @publicApi
|
|
549
|
+
*/
|
|
550
|
+
export declare function waitForAsync(fn: Function): (done: any) => any;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* @publicApi
|
|
554
|
+
*/
|
|
555
|
+
export declare function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper;
|
|
556
|
+
|
|
557
|
+
export declare function withModule(moduleDef: TestModuleMetadata, fn: Function): () => any;
|
|
558
|
+
|
|
559
|
+
export declare class ɵMetadataOverrider {
|
|
560
|
+
private _references;
|
|
561
|
+
/**
|
|
562
|
+
* Creates a new instance for the given metadata class
|
|
563
|
+
* based on an old instance and overrides.
|
|
564
|
+
*/
|
|
565
|
+
overrideMetadata<C extends T, T>(metadataClass: {
|
|
566
|
+
new (options: T): C;
|
|
567
|
+
}, oldMetadata: C, override: MetadataOverride<T>): C;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export { }
|