@angular/core 12.0.1 → 12.0.5
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/bundles/core-testing.umd.js +46 -83
- package/bundles/core-testing.umd.js.map +1 -1
- package/bundles/core.umd.js +43 -30
- package/bundles/core.umd.js.map +1 -1
- package/core.d.ts +245 -17
- package/core.metadata.json +1 -1
- package/esm2015/src/change_detection/differs/iterable_differs.js +1 -1
- package/esm2015/src/debug/debug_node.js +1 -1
- package/esm2015/src/di/injectable.js +1 -1
- package/esm2015/src/linker/component_factory_resolver.js +4 -1
- package/esm2015/src/metadata/di.js +1 -1
- package/esm2015/src/metadata/do_boostrap.js +1 -1
- package/esm2015/src/metadata/ng_module.js +1 -1
- package/esm2015/src/metadata/schema.js +5 -1
- package/esm2015/src/render3/definition.js +16 -16
- package/esm2015/src/render3/util/discovery_utils.js +18 -12
- package/esm2015/src/render3/view_ref.js +3 -3
- package/esm2015/src/version.js +1 -1
- package/esm2015/testing/src/fake_async.js +42 -25
- package/esm2015/testing/src/test_bed.js +5 -25
- package/esm2015/testing/src/testing_internal.js +1 -182
- package/fesm2015/core.js +43 -30
- package/fesm2015/core.js.map +1 -1
- package/fesm2015/testing.js +46 -76
- package/fesm2015/testing.js.map +1 -1
- package/package.json +2 -2
- package/schematics/migrations/deep-shadow-piercing-selector/index.d.ts +10 -0
- package/schematics/migrations/deep-shadow-piercing-selector/index.js +49 -0
- package/schematics/migrations.json +5 -0
- package/src/r3_symbols.d.ts +4 -1
- package/testing/testing.d.ts +42 -30
- package/testing/testing.metadata.json +1 -1
- package/testing.d.ts +1 -1
- package/esm2015/testing/src/async_test_completer.js +0 -28
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v12.0.
|
|
2
|
+
* @license Angular v12.0.5
|
|
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
|
-
* -
|
|
285
|
-
* -
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
319
|
-
*
|
|
320
|
-
* processNewMacroTasksSynchronously
|
|
321
|
-
*
|
|
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
|
-
*
|
|
338
|
-
*
|
|
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.
|
|
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
|
-
*
|
|
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
|
*/
|
|
@@ -716,40 +733,6 @@
|
|
|
716
733
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
717
734
|
}
|
|
718
735
|
|
|
719
|
-
/**
|
|
720
|
-
* @license
|
|
721
|
-
* Copyright Google LLC All Rights Reserved.
|
|
722
|
-
*
|
|
723
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
724
|
-
* found in the LICENSE file at https://angular.io/license
|
|
725
|
-
*/
|
|
726
|
-
/**
|
|
727
|
-
* Injectable completer that allows signaling completion of an asynchronous test. Used internally.
|
|
728
|
-
*/
|
|
729
|
-
var AsyncTestCompleter = /** @class */ (function () {
|
|
730
|
-
function AsyncTestCompleter() {
|
|
731
|
-
var _this = this;
|
|
732
|
-
this._promise = new Promise(function (res, rej) {
|
|
733
|
-
_this._resolve = res;
|
|
734
|
-
_this._reject = rej;
|
|
735
|
-
});
|
|
736
|
-
}
|
|
737
|
-
AsyncTestCompleter.prototype.done = function (value) {
|
|
738
|
-
this._resolve(value);
|
|
739
|
-
};
|
|
740
|
-
AsyncTestCompleter.prototype.fail = function (error, stackTrace) {
|
|
741
|
-
this._reject(error);
|
|
742
|
-
};
|
|
743
|
-
Object.defineProperty(AsyncTestCompleter.prototype, "promise", {
|
|
744
|
-
get: function () {
|
|
745
|
-
return this._promise;
|
|
746
|
-
},
|
|
747
|
-
enumerable: false,
|
|
748
|
-
configurable: true
|
|
749
|
-
});
|
|
750
|
-
return AsyncTestCompleter;
|
|
751
|
-
}());
|
|
752
|
-
|
|
753
736
|
/**
|
|
754
737
|
* @license
|
|
755
738
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -2863,34 +2846,14 @@
|
|
|
2863
2846
|
* })
|
|
2864
2847
|
* ```
|
|
2865
2848
|
*
|
|
2866
|
-
* Notes:
|
|
2867
|
-
* - inject is currently a function because of some Traceur limitation the syntax should
|
|
2868
|
-
* eventually
|
|
2869
|
-
* becomes `it('...', @Inject (object: AClass, async: AsyncTestCompleter) => { ... });`
|
|
2870
|
-
*
|
|
2871
2849
|
* @publicApi
|
|
2872
2850
|
*/
|
|
2873
2851
|
function inject(tokens, fn) {
|
|
2874
2852
|
var testBed = getTestBed();
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
return
|
|
2878
|
-
|
|
2879
|
-
// Return an async test method that returns a Promise if AsyncTestCompleter is one of
|
|
2880
|
-
// the injected tokens.
|
|
2881
|
-
return testBed.compileComponents().then(function () {
|
|
2882
|
-
var completer = testBed.inject(AsyncTestCompleter);
|
|
2883
|
-
testBed.execute(tokens, fn, _this);
|
|
2884
|
-
return completer.promise;
|
|
2885
|
-
});
|
|
2886
|
-
};
|
|
2887
|
-
}
|
|
2888
|
-
else {
|
|
2889
|
-
// Not using an arrow function to preserve context passed from call site
|
|
2890
|
-
return function () {
|
|
2891
|
-
return testBed.execute(tokens, fn, this);
|
|
2892
|
-
};
|
|
2893
|
-
}
|
|
2853
|
+
// Not using an arrow function to preserve context passed from call site
|
|
2854
|
+
return function () {
|
|
2855
|
+
return testBed.execute(tokens, fn, this);
|
|
2856
|
+
};
|
|
2894
2857
|
}
|
|
2895
2858
|
/**
|
|
2896
2859
|
* @publicApi
|