@angular/core 12.0.0-rc.2 → 12.0.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.0.0-rc.2
2
+ * @license Angular v12.0.2
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -280,21 +280,25 @@
280
280
  throw new Error(fakeAsyncTestModuleNotLoadedErrorMessage);
281
281
  }
282
282
  /**
283
- * Wraps a function to be executed in the fakeAsync zone:
284
- * - microtasks are manually executed by calling `flushMicrotasks()`,
285
- * - timers are synchronous, `tick()` simulates the asynchronous passage of time.
283
+ * Wraps a function to be executed in the `fakeAsync` zone:
284
+ * - Microtasks are manually executed by calling `flushMicrotasks()`.
285
+ * - Timers are synchronous; `tick()` simulates the asynchronous passage of time.
286
286
  *
287
- * If there are any pending timers at the end of the function, an exception will be thrown.
287
+ * If there are any pending timers at the end of the function, an exception is thrown.
288
288
  *
289
- * Can be used to wrap inject() calls.
289
+ * Can be used to wrap `inject()` calls.
290
+ *
291
+ * @param fn The function that you want to wrap in the `fakeAysnc` zone.
290
292
  *
291
293
  * @usageNotes
292
294
  * ### Example
293
295
  *
294
296
  * {@example core/testing/ts/fake_async.ts region='basic'}
295
297
  *
296
- * @param fn
297
- * @returns The function wrapped to be executed in the fakeAsync zone
298
+ *
299
+ * @returns The function wrapped to be executed in the `fakeAsync` zone.
300
+ * Any arguments passed when calling this returned function will be passed through to the `fn`
301
+ * function in the parameters when it is called.
298
302
  *
299
303
  * @publicApi
300
304
  */
@@ -305,23 +309,36 @@
305
309
  throw new Error(fakeAsyncTestModuleNotLoadedErrorMessage);
306
310
  }
307
311
  /**
308
- * Simulates the asynchronous passage of time for the timers in the fakeAsync zone.
312
+ * Simulates the asynchronous passage of time for the timers in the `fakeAsync` zone.
309
313
  *
310
314
  * The microtasks queue is drained at the very start of this function and after any timer callback
311
315
  * has been executed.
312
316
  *
317
+ * @param millis The number of milliseconds to advance the virtual timer.
318
+ * @param tickOptions The options to pass to the `tick()` function.
319
+ *
313
320
  * @usageNotes
321
+ *
322
+ * The `tick()` option is a flag called `processNewMacroTasksSynchronously`,
323
+ * which determines whether or not to invoke new macroTasks.
324
+ *
325
+ * If you provide a `tickOptions` object, but do not specify a
326
+ * `processNewMacroTasksSynchronously` property (`tick(100, {})`),
327
+ * then `processNewMacroTasksSynchronously` defaults to true.
328
+ *
329
+ * If you omit the `tickOptions` parameter (`tick(100))`), then
330
+ * `tickOptions` defaults to `{processNewMacroTasksSynchronously: true}`.
331
+ *
314
332
  * ### Example
315
333
  *
316
334
  * {@example core/testing/ts/fake_async.ts region='basic'}
317
335
  *
318
- * @param millis, the number of millisecond to advance the virtual timer
319
- * @param tickOptions, the options of tick with a flag called
320
- * processNewMacroTasksSynchronously, whether to invoke the new macroTasks, by default is
321
- * false, means the new macroTasks will be invoked
322
- *
323
- * For example,
336
+ * The following example includes a nested timeout (new macroTask), and
337
+ * the `tickOptions` parameter is allowed to default. In this case,
338
+ * `processNewMacroTasksSynchronously` defaults to true, and the nested
339
+ * function is executed on each tick.
324
340
  *
341
+ * ```
325
342
  * it ('test with nested setTimeout', fakeAsync(() => {
326
343
  * let nestedTimeoutInvoked = false;
327
344
  * function funcWithNestedTimeout() {
@@ -333,10 +350,12 @@
333
350
  * tick();
334
351
  * expect(nestedTimeoutInvoked).toBe(true);
335
352
  * }));
353
+ * ```
336
354
  *
337
- * in this case, we have a nested timeout (new macroTask), when we tick, both the
338
- * funcWithNestedTimeout and the nested timeout both will be invoked.
355
+ * In the following case, `processNewMacroTasksSynchronously` is explicitly
356
+ * set to false, so the nested timeout function is not invoked.
339
357
  *
358
+ * ```
340
359
  * it ('test with nested setTimeout', fakeAsync(() => {
341
360
  * let nestedTimeoutInvoked = false;
342
361
  * function funcWithNestedTimeout() {
@@ -348,9 +367,7 @@
348
367
  * tick(0, {processNewMacroTasksSynchronously: false});
349
368
  * expect(nestedTimeoutInvoked).toBe(false);
350
369
  * }));
351
- *
352
- * if we pass the tickOptions with processNewMacroTasksSynchronously to be false, the nested timeout
353
- * will not be invoked.
370
+ * ```
354
371
  *
355
372
  *
356
373
  * @publicApi
@@ -366,12 +383,12 @@
366
383
  throw new Error(fakeAsyncTestModuleNotLoadedErrorMessage);
367
384
  }
368
385
  /**
369
- * Simulates the asynchronous passage of time for the timers in the fakeAsync zone by
370
- * draining the macrotask queue until it is empty. The returned value is the milliseconds
371
- * of time that would have been elapsed.
386
+ * Simulates the asynchronous passage of time for the timers in the `fakeAsync` zone by
387
+ * draining the macrotask queue until it is empty.
372
388
  *
373
- * @param maxTurns
374
- * @returns The simulated time elapsed, in millis.
389
+ * @param maxTurns The maximum number of times the scheduler attempts to clear its queue before
390
+ * throwing an error.
391
+ * @returns The simulated time elapsed, in milliseconds.
375
392
  *
376
393
  * @publicApi
377
394
  */