@angular/core 14.1.0 → 14.2.0-next.1
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 +26 -21
- package/esm2020/src/core_private_export.mjs +2 -2
- package/esm2020/src/core_render3_private_export.mjs +4 -4
- package/esm2020/src/di/injector_compatibility.mjs +2 -2
- package/esm2020/src/di/interface/defs.mjs +4 -1
- package/esm2020/src/render3/component_ref.mjs +4 -31
- package/esm2020/src/render3/definition.mjs +5 -5
- package/esm2020/src/render3/index.mjs +4 -4
- package/esm2020/src/render3/instructions/change_detection.mjs +3 -19
- package/esm2020/src/render3/instructions/element_validation.mjs +9 -5
- package/esm2020/src/render3/instructions/shared.mjs +10 -50
- package/esm2020/src/render3/interfaces/view.mjs +1 -1
- package/esm2020/src/render3/jit/module.mjs +2 -6
- package/esm2020/src/render3/util/change_detection_utils.mjs +7 -3
- package/esm2020/src/render3/util/misc_utils.mjs +1 -7
- 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/test_bed.mjs +442 -15
- package/esm2020/testing/src/test_bed_common.mjs +1 -1
- package/esm2020/testing/src/test_bed_compiler.mjs +823 -0
- package/esm2020/testing/src/test_hooks.mjs +5 -5
- package/esm2020/testing/src/testing.mjs +1 -1
- package/fesm2015/core.mjs +56 -132
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +132 -218
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +56 -132
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +132 -219
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +7 -100
- package/package.json +1 -1
- package/testing/index.d.ts +18 -94
- package/esm2020/src/render3/interfaces/player.mjs +0 -9
- package/esm2020/testing/src/r3_test_bed.mjs +0 -433
- package/esm2020/testing/src/r3_test_bed_compiler.mjs +0 -823
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.
|
|
2
|
+
* @license Angular v14.2.0-next.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getDebugNode as getDebugNode$1, RendererFactory2 as RendererFactory2$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ModuleWithComponentFactories,
|
|
7
|
+
import { getDebugNode as getDebugNode$1, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ModuleWithComponentFactories, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
8
8
|
import { __awaiter } from 'tslib';
|
|
9
9
|
import { ResourceLoader } from '@angular/compiler';
|
|
10
10
|
import { Subject, Subscription } from 'rxjs';
|
|
@@ -414,6 +414,37 @@ function flushMicrotasks() {
|
|
|
414
414
|
throw new Error(fakeAsyncTestModuleNotLoadedErrorMessage);
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
+
/**
|
|
418
|
+
* @license
|
|
419
|
+
* Copyright Google LLC All Rights Reserved.
|
|
420
|
+
*
|
|
421
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
422
|
+
* found in the LICENSE file at https://angular.io/license
|
|
423
|
+
*/
|
|
424
|
+
/** Whether test modules should be torn down by default. */
|
|
425
|
+
const TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT = true;
|
|
426
|
+
/** Whether unknown elements in templates should throw by default. */
|
|
427
|
+
const THROW_ON_UNKNOWN_ELEMENTS_DEFAULT = false;
|
|
428
|
+
/** Whether unknown properties in templates should throw by default. */
|
|
429
|
+
const THROW_ON_UNKNOWN_PROPERTIES_DEFAULT = false;
|
|
430
|
+
/**
|
|
431
|
+
* An abstract class for inserting the root test component element in a platform independent way.
|
|
432
|
+
*
|
|
433
|
+
* @publicApi
|
|
434
|
+
*/
|
|
435
|
+
class TestComponentRenderer {
|
|
436
|
+
insertRootElement(rootElementId) { }
|
|
437
|
+
removeAllRootElements() { }
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* @publicApi
|
|
441
|
+
*/
|
|
442
|
+
const ComponentFixtureAutoDetect = new InjectionToken$1('ComponentFixtureAutoDetect');
|
|
443
|
+
/**
|
|
444
|
+
* @publicApi
|
|
445
|
+
*/
|
|
446
|
+
const ComponentFixtureNoNgZone = new InjectionToken$1('ComponentFixtureNoNgZone');
|
|
447
|
+
|
|
417
448
|
/**
|
|
418
449
|
* @license
|
|
419
450
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -804,6 +835,9 @@ function ɵɵdefineInjector(options) {
|
|
|
804
835
|
function getInjectableDef(type) {
|
|
805
836
|
return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF);
|
|
806
837
|
}
|
|
838
|
+
function isInjectable(type) {
|
|
839
|
+
return getInjectableDef(type) !== null;
|
|
840
|
+
}
|
|
807
841
|
/**
|
|
808
842
|
* Return definition only if it is defined directly on `type` and is not inherited from a base
|
|
809
843
|
* class of `type`.
|
|
@@ -2048,7 +2082,7 @@ function setCurrentInjector(injector) {
|
|
|
2048
2082
|
function injectInjectorOnly(token, flags = InjectFlags.Default) {
|
|
2049
2083
|
if (_currentInjector === undefined) {
|
|
2050
2084
|
throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
|
|
2051
|
-
`inject() must be called from an injection context
|
|
2085
|
+
`inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \`EnvironmentInjector#runInContext\`.`);
|
|
2052
2086
|
}
|
|
2053
2087
|
else if (_currentInjector === null) {
|
|
2054
2088
|
return injectRootLimpMode(token, undefined, flags);
|
|
@@ -2574,7 +2608,6 @@ function extractDirectiveDef(type) {
|
|
|
2574
2608
|
function nonNull(value) {
|
|
2575
2609
|
return value !== null;
|
|
2576
2610
|
}
|
|
2577
|
-
const autoRegisterModuleById = {};
|
|
2578
2611
|
/**
|
|
2579
2612
|
* @codeGenApi
|
|
2580
2613
|
*/
|
|
@@ -2590,9 +2623,6 @@ function ɵɵdefineNgModule(def) {
|
|
|
2590
2623
|
schemas: def.schemas || null,
|
|
2591
2624
|
id: def.id || null,
|
|
2592
2625
|
};
|
|
2593
|
-
if (def.id != null) {
|
|
2594
|
-
autoRegisterModuleById[def.id] = def.type;
|
|
2595
|
-
}
|
|
2596
2626
|
return res;
|
|
2597
2627
|
});
|
|
2598
2628
|
}
|
|
@@ -2746,6 +2776,10 @@ function getDirectiveDef(type) {
|
|
|
2746
2776
|
function getPipeDef$1(type) {
|
|
2747
2777
|
return type[NG_PIPE_DEF] || null;
|
|
2748
2778
|
}
|
|
2779
|
+
function isStandalone(type) {
|
|
2780
|
+
const def = getComponentDef$1(type) || getDirectiveDef(type) || getPipeDef$1(type);
|
|
2781
|
+
return def !== null ? def.standalone : false;
|
|
2782
|
+
}
|
|
2749
2783
|
function getNgModuleDef(type, throwNotFound) {
|
|
2750
2784
|
const ngModuleDef = type[NG_MOD_DEF] || null;
|
|
2751
2785
|
if (!ngModuleDef && throwNotFound === true) {
|
|
@@ -5471,11 +5505,6 @@ function setAllowDuplicateNgModuleIdsForTest(allowDuplicates) {
|
|
|
5471
5505
|
* Use of this source code is governed by an MIT-style license that can be
|
|
5472
5506
|
* found in the LICENSE file at https://angular.io/license
|
|
5473
5507
|
*/
|
|
5474
|
-
const defaultScheduler = (() => (typeof requestAnimationFrame !== 'undefined' &&
|
|
5475
|
-
requestAnimationFrame || // browser only
|
|
5476
|
-
setTimeout // everything else
|
|
5477
|
-
)
|
|
5478
|
-
.bind(_global$1))();
|
|
5479
5508
|
/**
|
|
5480
5509
|
*
|
|
5481
5510
|
* @codeGenApi
|
|
@@ -7618,7 +7647,7 @@ class Version {
|
|
|
7618
7647
|
/**
|
|
7619
7648
|
* @publicApi
|
|
7620
7649
|
*/
|
|
7621
|
-
const VERSION = new Version('14.
|
|
7650
|
+
const VERSION = new Version('14.2.0-next.1');
|
|
7622
7651
|
|
|
7623
7652
|
/**
|
|
7624
7653
|
* @license
|
|
@@ -7834,9 +7863,10 @@ function handleUnknownPropertyError(propName, tagName, nodeType, lView) {
|
|
|
7834
7863
|
'a part of an @NgModule where this component is declared';
|
|
7835
7864
|
if (KNOWN_CONTROL_FLOW_DIRECTIVES.has(propName)) {
|
|
7836
7865
|
// Most likely this is a control flow directive (such as `*ngIf`) used in
|
|
7837
|
-
// a template, but the `CommonModule` is not imported.
|
|
7866
|
+
// a template, but the directive or the `CommonModule` is not imported.
|
|
7867
|
+
const correspondingImport = KNOWN_CONTROL_FLOW_DIRECTIVES.get(propName);
|
|
7838
7868
|
message += `\nIf the '${propName}' is an Angular control flow directive, ` +
|
|
7839
|
-
`please make sure that the 'CommonModule' is ${importLocation}.`;
|
|
7869
|
+
`please make sure that either the '${correspondingImport}' directive or the 'CommonModule' is ${importLocation}.`;
|
|
7840
7870
|
}
|
|
7841
7871
|
else {
|
|
7842
7872
|
// May be an Angular component, which is not imported/declared?
|
|
@@ -7916,11 +7946,14 @@ function getTemplateLocationDetails(lView) {
|
|
|
7916
7946
|
return componentClassName ? ` (used in the '${componentClassName}' component template)` : '';
|
|
7917
7947
|
}
|
|
7918
7948
|
/**
|
|
7919
|
-
* The set of known control flow directives.
|
|
7949
|
+
* The set of known control flow directives and their corresponding imports.
|
|
7920
7950
|
* We use this set to produce a more precises error message with a note
|
|
7921
7951
|
* that the `CommonModule` should also be included.
|
|
7922
7952
|
*/
|
|
7923
|
-
const KNOWN_CONTROL_FLOW_DIRECTIVES = new
|
|
7953
|
+
const KNOWN_CONTROL_FLOW_DIRECTIVES = new Map([
|
|
7954
|
+
['ngIf', 'NgIf'], ['ngFor', 'NgForOf'], ['ngSwitchCase', 'NgSwitchCase'],
|
|
7955
|
+
['ngSwitchDefault', 'NgSwitchDefault']
|
|
7956
|
+
]);
|
|
7924
7957
|
/**
|
|
7925
7958
|
* Returns true if the tag name is allowed by specified schemas.
|
|
7926
7959
|
* @param schemas Array of schemas
|
|
@@ -12012,11 +12045,6 @@ class LContainerDebug {
|
|
|
12012
12045
|
* Use of this source code is governed by an MIT-style license that can be
|
|
12013
12046
|
* found in the LICENSE file at https://angular.io/license
|
|
12014
12047
|
*/
|
|
12015
|
-
/**
|
|
12016
|
-
* A permanent marker promise which signifies that the current CD tree is
|
|
12017
|
-
* clean.
|
|
12018
|
-
*/
|
|
12019
|
-
const _CLEAN_PROMISE = (() => Promise.resolve(null))();
|
|
12020
12048
|
/**
|
|
12021
12049
|
* Invoke `HostBindingsFunction`s for view.
|
|
12022
12050
|
*
|
|
@@ -13397,13 +13425,15 @@ function refreshContainsDirtyView(lView) {
|
|
|
13397
13425
|
for (let lContainer = getFirstLContainer(lView); lContainer !== null; lContainer = getNextLContainer(lContainer)) {
|
|
13398
13426
|
for (let i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) {
|
|
13399
13427
|
const embeddedLView = lContainer[i];
|
|
13400
|
-
if (embeddedLView
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13406
|
-
|
|
13428
|
+
if (viewAttachedToChangeDetector(embeddedLView)) {
|
|
13429
|
+
if (embeddedLView[FLAGS] & 512 /* LViewFlags.RefreshTransplantedView */) {
|
|
13430
|
+
const embeddedTView = embeddedLView[TVIEW];
|
|
13431
|
+
ngDevMode && assertDefined(embeddedTView, 'TView must be allocated');
|
|
13432
|
+
refreshView(embeddedTView, embeddedLView, embeddedTView.template, embeddedLView[CONTEXT]);
|
|
13433
|
+
}
|
|
13434
|
+
else if (embeddedLView[TRANSPLANTED_VIEWS_TO_REFRESH] > 0) {
|
|
13435
|
+
refreshContainsDirtyView(embeddedLView);
|
|
13436
|
+
}
|
|
13407
13437
|
}
|
|
13408
13438
|
}
|
|
13409
13439
|
}
|
|
@@ -13512,42 +13542,6 @@ function markViewDirty(lView) {
|
|
|
13512
13542
|
}
|
|
13513
13543
|
return null;
|
|
13514
13544
|
}
|
|
13515
|
-
/**
|
|
13516
|
-
* Used to schedule change detection on the whole application.
|
|
13517
|
-
*
|
|
13518
|
-
* Unlike `tick`, `scheduleTick` coalesces multiple calls into one change detection run.
|
|
13519
|
-
* It is usually called indirectly by calling `markDirty` when the view needs to be
|
|
13520
|
-
* re-rendered.
|
|
13521
|
-
*
|
|
13522
|
-
* Typically `scheduleTick` uses `requestAnimationFrame` to coalesce multiple
|
|
13523
|
-
* `scheduleTick` requests. The scheduling function can be overridden in
|
|
13524
|
-
* `renderComponent`'s `scheduler` option.
|
|
13525
|
-
*/
|
|
13526
|
-
function scheduleTick(rootContext, flags) {
|
|
13527
|
-
const nothingScheduled = rootContext.flags === 0 /* RootContextFlags.Empty */;
|
|
13528
|
-
if (nothingScheduled && rootContext.clean == _CLEAN_PROMISE) {
|
|
13529
|
-
// https://github.com/angular/angular/issues/39296
|
|
13530
|
-
// should only attach the flags when really scheduling a tick
|
|
13531
|
-
rootContext.flags |= flags;
|
|
13532
|
-
let res;
|
|
13533
|
-
rootContext.clean = new Promise((r) => res = r);
|
|
13534
|
-
rootContext.scheduler(() => {
|
|
13535
|
-
if (rootContext.flags & 1 /* RootContextFlags.DetectChanges */) {
|
|
13536
|
-
rootContext.flags &= ~1 /* RootContextFlags.DetectChanges */;
|
|
13537
|
-
tickRootContext(rootContext);
|
|
13538
|
-
}
|
|
13539
|
-
if (rootContext.flags & 2 /* RootContextFlags.FlushPlayers */) {
|
|
13540
|
-
rootContext.flags &= ~2 /* RootContextFlags.FlushPlayers */;
|
|
13541
|
-
const playerHandler = rootContext.playerHandler;
|
|
13542
|
-
if (playerHandler) {
|
|
13543
|
-
playerHandler.flushPlayers();
|
|
13544
|
-
}
|
|
13545
|
-
}
|
|
13546
|
-
rootContext.clean = _CLEAN_PROMISE;
|
|
13547
|
-
res(null);
|
|
13548
|
-
});
|
|
13549
|
-
}
|
|
13550
|
-
}
|
|
13551
13545
|
function tickRootContext(rootContext) {
|
|
13552
13546
|
for (let i = 0; i < rootContext.components.length; i++) {
|
|
13553
13547
|
const rootComponent = rootContext.components[i];
|
|
@@ -13656,7 +13650,6 @@ function storePropertyBindingMetadata(tData, tNode, propertyName, bindingIndex,
|
|
|
13656
13650
|
}
|
|
13657
13651
|
}
|
|
13658
13652
|
}
|
|
13659
|
-
const CLEAN_PROMISE = _CLEAN_PROMISE;
|
|
13660
13653
|
function getOrCreateLViewCleanup(view) {
|
|
13661
13654
|
// top level variables should not be exported for performance reasons (PERF_NOTES.md)
|
|
13662
13655
|
return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new LCleanup() : []);
|
|
@@ -14415,14 +14408,8 @@ function createRootComponent(componentView, componentDef, rootLView, rootContext
|
|
|
14415
14408
|
}
|
|
14416
14409
|
return component;
|
|
14417
14410
|
}
|
|
14418
|
-
function createRootContext(
|
|
14419
|
-
return {
|
|
14420
|
-
components: [],
|
|
14421
|
-
scheduler: scheduler || defaultScheduler,
|
|
14422
|
-
clean: CLEAN_PROMISE,
|
|
14423
|
-
playerHandler: playerHandler || null,
|
|
14424
|
-
flags: 0 /* RootContextFlags.Empty */
|
|
14425
|
-
};
|
|
14411
|
+
function createRootContext() {
|
|
14412
|
+
return { components: [] };
|
|
14426
14413
|
}
|
|
14427
14414
|
/**
|
|
14428
14415
|
* Used to enable lifecycle hooks on the root component.
|
|
@@ -14442,25 +14429,6 @@ function LifecycleHooksFeature() {
|
|
|
14442
14429
|
ngDevMode && assertDefined(tNode, 'TNode is required');
|
|
14443
14430
|
registerPostOrderHooks(getLView()[TVIEW], tNode);
|
|
14444
14431
|
}
|
|
14445
|
-
/**
|
|
14446
|
-
* Wait on component until it is rendered.
|
|
14447
|
-
*
|
|
14448
|
-
* This function returns a `Promise` which is resolved when the component's
|
|
14449
|
-
* change detection is executed. This is determined by finding the scheduler
|
|
14450
|
-
* associated with the `component`'s render tree and waiting until the scheduler
|
|
14451
|
-
* flushes. If nothing is scheduled, the function returns a resolved promise.
|
|
14452
|
-
*
|
|
14453
|
-
* Example:
|
|
14454
|
-
* ```
|
|
14455
|
-
* await whenRendered(myComponent);
|
|
14456
|
-
* ```
|
|
14457
|
-
*
|
|
14458
|
-
* @param component Component to wait upon
|
|
14459
|
-
* @returns Promise which resolves when the component is rendered.
|
|
14460
|
-
*/
|
|
14461
|
-
function whenRendered(component) {
|
|
14462
|
-
return getRootContext(component).clean;
|
|
14463
|
-
}
|
|
14464
14432
|
|
|
14465
14433
|
/**
|
|
14466
14434
|
* @license
|
|
@@ -15445,21 +15413,6 @@ function detectChanges(component) {
|
|
|
15445
15413
|
const view = getComponentViewByInstance(component);
|
|
15446
15414
|
detectChangesInternal(view[TVIEW], view, component);
|
|
15447
15415
|
}
|
|
15448
|
-
/**
|
|
15449
|
-
* Marks the component as dirty (needing change detection). Marking a component dirty will
|
|
15450
|
-
* schedule a change detection on it at some point in the future.
|
|
15451
|
-
*
|
|
15452
|
-
* Marking an already dirty component as dirty won't do anything. Only one outstanding change
|
|
15453
|
-
* detection can be scheduled per component tree.
|
|
15454
|
-
*
|
|
15455
|
-
* @param component Component to mark as dirty.
|
|
15456
|
-
*/
|
|
15457
|
-
function markDirty(component) {
|
|
15458
|
-
ngDevMode && assertDefined(component, 'component');
|
|
15459
|
-
const rootView = markViewDirty(getComponentViewByInstance(component));
|
|
15460
|
-
ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined');
|
|
15461
|
-
scheduleTick(rootView[CONTEXT], 1 /* RootContextFlags.DetectChanges */);
|
|
15462
|
-
}
|
|
15463
15416
|
|
|
15464
15417
|
/**
|
|
15465
15418
|
* @license
|
|
@@ -24622,10 +24575,6 @@ function compileNgModuleDefs(moduleType, ngModule, allowDuplicateDeclarationsInR
|
|
|
24622
24575
|
configurable: !!ngDevMode,
|
|
24623
24576
|
});
|
|
24624
24577
|
}
|
|
24625
|
-
function isStandalone(type) {
|
|
24626
|
-
const def = getComponentDef$1(type) || getDirectiveDef(type) || getPipeDef$1(type);
|
|
24627
|
-
return def !== null ? def.standalone : false;
|
|
24628
|
-
}
|
|
24629
24578
|
function generateStandaloneInDeclarationsError(type, location) {
|
|
24630
24579
|
const prefix = `Unexpected "${stringifyForError(type)}" found in the "declarations" array of the`;
|
|
24631
24580
|
const suffix = `"${stringifyForError(type)}" is marked as standalone and can't be declared ` +
|
|
@@ -25229,7 +25178,7 @@ function assertNoStandaloneComponents(types, resolver, location) {
|
|
|
25229
25178
|
}
|
|
25230
25179
|
});
|
|
25231
25180
|
}
|
|
25232
|
-
class
|
|
25181
|
+
class TestBedCompiler {
|
|
25233
25182
|
constructor(platform, additionalModuleTypes) {
|
|
25234
25183
|
this.platform = platform;
|
|
25235
25184
|
this.additionalModuleTypes = additionalModuleTypes;
|
|
@@ -26042,49 +25991,23 @@ class R3TestCompiler {
|
|
|
26042
25991
|
* Use of this source code is governed by an MIT-style license that can be
|
|
26043
25992
|
* found in the LICENSE file at https://angular.io/license
|
|
26044
25993
|
*/
|
|
26045
|
-
|
|
26046
|
-
const TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT = true;
|
|
26047
|
-
/** Whether unknown elements in templates should throw by default. */
|
|
26048
|
-
const THROW_ON_UNKNOWN_ELEMENTS_DEFAULT = false;
|
|
26049
|
-
/** Whether unknown properties in templates should throw by default. */
|
|
26050
|
-
const THROW_ON_UNKNOWN_PROPERTIES_DEFAULT = false;
|
|
25994
|
+
let _nextRootElementId = 0;
|
|
26051
25995
|
/**
|
|
26052
|
-
*
|
|
25996
|
+
* Returns a singleton of the `TestBed` class.
|
|
26053
25997
|
*
|
|
26054
25998
|
* @publicApi
|
|
26055
25999
|
*/
|
|
26056
|
-
|
|
26057
|
-
|
|
26058
|
-
removeAllRootElements() { }
|
|
26000
|
+
function getTestBed() {
|
|
26001
|
+
return TestBedImpl.INSTANCE;
|
|
26059
26002
|
}
|
|
26060
|
-
/**
|
|
26061
|
-
* @publicApi
|
|
26062
|
-
*/
|
|
26063
|
-
const ComponentFixtureAutoDetect = new InjectionToken$1('ComponentFixtureAutoDetect');
|
|
26064
|
-
/**
|
|
26065
|
-
* @publicApi
|
|
26066
|
-
*/
|
|
26067
|
-
const ComponentFixtureNoNgZone = new InjectionToken$1('ComponentFixtureNoNgZone');
|
|
26068
|
-
|
|
26069
|
-
/**
|
|
26070
|
-
* @license
|
|
26071
|
-
* Copyright Google LLC All Rights Reserved.
|
|
26072
|
-
*
|
|
26073
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
26074
|
-
* found in the LICENSE file at https://angular.io/license
|
|
26075
|
-
*/
|
|
26076
|
-
let _nextRootElementId = 0;
|
|
26077
26003
|
/**
|
|
26078
26004
|
* @description
|
|
26079
26005
|
* Configures and initializes environment for unit testing and provides methods for
|
|
26080
26006
|
* creating components and services in unit tests.
|
|
26081
26007
|
*
|
|
26082
26008
|
* TestBed is the primary api for writing unit tests for Angular applications and libraries.
|
|
26083
|
-
*
|
|
26084
|
-
* Note: Use `TestBed` in tests. It will be set to either `TestBedViewEngine` or `TestBedRender3`
|
|
26085
|
-
* according to the compiler used.
|
|
26086
26009
|
*/
|
|
26087
|
-
class
|
|
26010
|
+
class TestBedImpl {
|
|
26088
26011
|
constructor() {
|
|
26089
26012
|
// Properties
|
|
26090
26013
|
this.platform = null;
|
|
@@ -26092,7 +26015,15 @@ class TestBedRender3 {
|
|
|
26092
26015
|
this._compiler = null;
|
|
26093
26016
|
this._testModuleRef = null;
|
|
26094
26017
|
this._activeFixtures = [];
|
|
26095
|
-
|
|
26018
|
+
/**
|
|
26019
|
+
* Internal-only flag to indicate whether a module
|
|
26020
|
+
* scoping queue has been checked and flushed already.
|
|
26021
|
+
* @nodoc
|
|
26022
|
+
*/
|
|
26023
|
+
this.globalCompilationChecked = false;
|
|
26024
|
+
}
|
|
26025
|
+
static get INSTANCE() {
|
|
26026
|
+
return TestBedImpl._INSTANCE = TestBedImpl._INSTANCE || new TestBedImpl();
|
|
26096
26027
|
}
|
|
26097
26028
|
/**
|
|
26098
26029
|
* Initialize the environment for testing with a compiler factory, a PlatformRef, and an
|
|
@@ -26108,7 +26039,7 @@ class TestBedRender3 {
|
|
|
26108
26039
|
* @publicApi
|
|
26109
26040
|
*/
|
|
26110
26041
|
static initTestEnvironment(ngModule, platform, options) {
|
|
26111
|
-
const testBed =
|
|
26042
|
+
const testBed = TestBedImpl.INSTANCE;
|
|
26112
26043
|
testBed.initTestEnvironment(ngModule, platform, options);
|
|
26113
26044
|
return testBed;
|
|
26114
26045
|
}
|
|
@@ -26118,19 +26049,17 @@ class TestBedRender3 {
|
|
|
26118
26049
|
* @publicApi
|
|
26119
26050
|
*/
|
|
26120
26051
|
static resetTestEnvironment() {
|
|
26121
|
-
|
|
26052
|
+
TestBedImpl.INSTANCE.resetTestEnvironment();
|
|
26122
26053
|
}
|
|
26123
26054
|
static configureCompiler(config) {
|
|
26124
|
-
|
|
26125
|
-
return TestBedRender3;
|
|
26055
|
+
return TestBedImpl.INSTANCE.configureCompiler(config);
|
|
26126
26056
|
}
|
|
26127
26057
|
/**
|
|
26128
26058
|
* Allows overriding default providers, directives, pipes, modules of the test injector,
|
|
26129
26059
|
* which are defined in test_injector.js
|
|
26130
26060
|
*/
|
|
26131
26061
|
static configureTestingModule(moduleDef) {
|
|
26132
|
-
|
|
26133
|
-
return TestBedRender3;
|
|
26062
|
+
return TestBedImpl.INSTANCE.configureTestingModule(moduleDef);
|
|
26134
26063
|
}
|
|
26135
26064
|
/**
|
|
26136
26065
|
* Compile components with a `templateUrl` for the test's NgModule.
|
|
@@ -26138,27 +26067,22 @@ class TestBedRender3 {
|
|
|
26138
26067
|
* as fetching urls is asynchronous.
|
|
26139
26068
|
*/
|
|
26140
26069
|
static compileComponents() {
|
|
26141
|
-
return
|
|
26070
|
+
return TestBedImpl.INSTANCE.compileComponents();
|
|
26142
26071
|
}
|
|
26143
26072
|
static overrideModule(ngModule, override) {
|
|
26144
|
-
|
|
26145
|
-
return TestBedRender3;
|
|
26073
|
+
return TestBedImpl.INSTANCE.overrideModule(ngModule, override);
|
|
26146
26074
|
}
|
|
26147
26075
|
static overrideComponent(component, override) {
|
|
26148
|
-
|
|
26149
|
-
return TestBedRender3;
|
|
26076
|
+
return TestBedImpl.INSTANCE.overrideComponent(component, override);
|
|
26150
26077
|
}
|
|
26151
26078
|
static overrideDirective(directive, override) {
|
|
26152
|
-
|
|
26153
|
-
return TestBedRender3;
|
|
26079
|
+
return TestBedImpl.INSTANCE.overrideDirective(directive, override);
|
|
26154
26080
|
}
|
|
26155
26081
|
static overridePipe(pipe, override) {
|
|
26156
|
-
|
|
26157
|
-
return TestBedRender3;
|
|
26082
|
+
return TestBedImpl.INSTANCE.overridePipe(pipe, override);
|
|
26158
26083
|
}
|
|
26159
26084
|
static overrideTemplate(component, template) {
|
|
26160
|
-
|
|
26161
|
-
return TestBedRender3;
|
|
26085
|
+
return TestBedImpl.INSTANCE.overrideTemplate(component, template);
|
|
26162
26086
|
}
|
|
26163
26087
|
/**
|
|
26164
26088
|
* Overrides the template of the given component, compiling the template
|
|
@@ -26167,32 +26091,32 @@ class TestBedRender3 {
|
|
|
26167
26091
|
* Note: This works for JIT and AOTed components as well.
|
|
26168
26092
|
*/
|
|
26169
26093
|
static overrideTemplateUsingTestingModule(component, template) {
|
|
26170
|
-
|
|
26171
|
-
return TestBedRender3;
|
|
26094
|
+
return TestBedImpl.INSTANCE.overrideTemplateUsingTestingModule(component, template);
|
|
26172
26095
|
}
|
|
26173
26096
|
static overrideProvider(token, provider) {
|
|
26174
|
-
|
|
26175
|
-
return TestBedRender3;
|
|
26097
|
+
return TestBedImpl.INSTANCE.overrideProvider(token, provider);
|
|
26176
26098
|
}
|
|
26177
26099
|
static inject(token, notFoundValue, flags) {
|
|
26178
|
-
return
|
|
26100
|
+
return TestBedImpl.INSTANCE.inject(token, notFoundValue, flags);
|
|
26179
26101
|
}
|
|
26180
26102
|
/** @deprecated from v9.0.0 use TestBed.inject */
|
|
26181
26103
|
static get(token, notFoundValue = Injector$1.THROW_IF_NOT_FOUND, flags = InjectFlags$1.Default) {
|
|
26182
|
-
return
|
|
26104
|
+
return TestBedImpl.INSTANCE.inject(token, notFoundValue, flags);
|
|
26183
26105
|
}
|
|
26184
26106
|
static createComponent(component) {
|
|
26185
|
-
return
|
|
26107
|
+
return TestBedImpl.INSTANCE.createComponent(component);
|
|
26186
26108
|
}
|
|
26187
26109
|
static resetTestingModule() {
|
|
26188
|
-
|
|
26189
|
-
return TestBedRender3;
|
|
26110
|
+
return TestBedImpl.INSTANCE.resetTestingModule();
|
|
26190
26111
|
}
|
|
26191
|
-
static
|
|
26192
|
-
return
|
|
26112
|
+
static execute(tokens, fn, context) {
|
|
26113
|
+
return TestBedImpl.INSTANCE.execute(tokens, fn, context);
|
|
26193
26114
|
}
|
|
26194
|
-
static
|
|
26195
|
-
|
|
26115
|
+
static get platform() {
|
|
26116
|
+
return TestBedImpl.INSTANCE.platform;
|
|
26117
|
+
}
|
|
26118
|
+
static get ngModule() {
|
|
26119
|
+
return TestBedImpl.INSTANCE.ngModule;
|
|
26196
26120
|
}
|
|
26197
26121
|
/**
|
|
26198
26122
|
* Initialize the environment for testing with a compiler factory, a PlatformRef, and an
|
|
@@ -26211,12 +26135,12 @@ class TestBedRender3 {
|
|
|
26211
26135
|
if (this.platform || this.ngModule) {
|
|
26212
26136
|
throw new Error('Cannot set base providers because it has already been called');
|
|
26213
26137
|
}
|
|
26214
|
-
|
|
26215
|
-
|
|
26216
|
-
|
|
26138
|
+
TestBedImpl._environmentTeardownOptions = options === null || options === void 0 ? void 0 : options.teardown;
|
|
26139
|
+
TestBedImpl._environmentErrorOnUnknownElementsOption = options === null || options === void 0 ? void 0 : options.errorOnUnknownElements;
|
|
26140
|
+
TestBedImpl._environmentErrorOnUnknownPropertiesOption = options === null || options === void 0 ? void 0 : options.errorOnUnknownProperties;
|
|
26217
26141
|
this.platform = platform;
|
|
26218
26142
|
this.ngModule = ngModule;
|
|
26219
|
-
this._compiler = new
|
|
26143
|
+
this._compiler = new TestBedCompiler(this.platform, this.ngModule);
|
|
26220
26144
|
// TestBed does not have an API which can reliably detect the start of a test, and thus could be
|
|
26221
26145
|
// used to track the state of the NgModule registry and reset it correctly. Instead, when we
|
|
26222
26146
|
// know we're in a testing scenario, we disable the check for duplicate NgModule registration
|
|
@@ -26233,7 +26157,7 @@ class TestBedRender3 {
|
|
|
26233
26157
|
this._compiler = null;
|
|
26234
26158
|
this.platform = null;
|
|
26235
26159
|
this.ngModule = null;
|
|
26236
|
-
|
|
26160
|
+
TestBedImpl._environmentTeardownOptions = undefined;
|
|
26237
26161
|
ɵsetAllowDuplicateNgModuleIdsForTest(false);
|
|
26238
26162
|
}
|
|
26239
26163
|
resetTestingModule() {
|
|
@@ -26243,7 +26167,7 @@ class TestBedRender3 {
|
|
|
26243
26167
|
if (this._compiler !== null) {
|
|
26244
26168
|
this.compiler.restoreOriginalState();
|
|
26245
26169
|
}
|
|
26246
|
-
this._compiler = new
|
|
26170
|
+
this._compiler = new TestBedCompiler(this.platform, this.ngModule);
|
|
26247
26171
|
// Restore the previous value of the "error on unknown elements" option
|
|
26248
26172
|
ɵsetUnknownElementStrictMode$1((_a = this._previousErrorOnUnknownElementsOption) !== null && _a !== void 0 ? _a : THROW_ON_UNKNOWN_ELEMENTS_DEFAULT);
|
|
26249
26173
|
// Restore the previous value of the "error on unknown properties" option
|
|
@@ -26267,6 +26191,7 @@ class TestBedRender3 {
|
|
|
26267
26191
|
this._instanceErrorOnUnknownPropertiesOption = undefined;
|
|
26268
26192
|
}
|
|
26269
26193
|
}
|
|
26194
|
+
return this;
|
|
26270
26195
|
}
|
|
26271
26196
|
configureCompiler(config) {
|
|
26272
26197
|
if (config.useJit != null) {
|
|
@@ -26275,6 +26200,7 @@ class TestBedRender3 {
|
|
|
26275
26200
|
if (config.providers !== undefined) {
|
|
26276
26201
|
this.compiler.setCompilerProviders(config.providers);
|
|
26277
26202
|
}
|
|
26203
|
+
return this;
|
|
26278
26204
|
}
|
|
26279
26205
|
configureTestingModule(moduleDef) {
|
|
26280
26206
|
this.assertNotInstantiated('R3TestBed.configureTestingModule', 'configure the test module');
|
|
@@ -26295,12 +26221,13 @@ class TestBedRender3 {
|
|
|
26295
26221
|
this._previousErrorOnUnknownPropertiesOption = ɵgetUnknownPropertyStrictMode$1();
|
|
26296
26222
|
ɵsetUnknownPropertyStrictMode$1(this.shouldThrowErrorOnUnknownProperties());
|
|
26297
26223
|
this.compiler.configureTestingModule(moduleDef);
|
|
26224
|
+
return this;
|
|
26298
26225
|
}
|
|
26299
26226
|
compileComponents() {
|
|
26300
26227
|
return this.compiler.compileComponents();
|
|
26301
26228
|
}
|
|
26302
26229
|
inject(token, notFoundValue, flags) {
|
|
26303
|
-
if (token ===
|
|
26230
|
+
if (token === TestBed) {
|
|
26304
26231
|
return this;
|
|
26305
26232
|
}
|
|
26306
26233
|
const UNDEFINED = {};
|
|
@@ -26319,22 +26246,27 @@ class TestBedRender3 {
|
|
|
26319
26246
|
overrideModule(ngModule, override) {
|
|
26320
26247
|
this.assertNotInstantiated('overrideModule', 'override module metadata');
|
|
26321
26248
|
this.compiler.overrideModule(ngModule, override);
|
|
26249
|
+
return this;
|
|
26322
26250
|
}
|
|
26323
26251
|
overrideComponent(component, override) {
|
|
26324
26252
|
this.assertNotInstantiated('overrideComponent', 'override component metadata');
|
|
26325
26253
|
this.compiler.overrideComponent(component, override);
|
|
26254
|
+
return this;
|
|
26326
26255
|
}
|
|
26327
26256
|
overrideTemplateUsingTestingModule(component, template) {
|
|
26328
26257
|
this.assertNotInstantiated('R3TestBed.overrideTemplateUsingTestingModule', 'Cannot override template when the test module has already been instantiated');
|
|
26329
26258
|
this.compiler.overrideTemplateUsingTestingModule(component, template);
|
|
26259
|
+
return this;
|
|
26330
26260
|
}
|
|
26331
26261
|
overrideDirective(directive, override) {
|
|
26332
26262
|
this.assertNotInstantiated('overrideDirective', 'override directive metadata');
|
|
26333
26263
|
this.compiler.overrideDirective(directive, override);
|
|
26264
|
+
return this;
|
|
26334
26265
|
}
|
|
26335
26266
|
overridePipe(pipe, override) {
|
|
26336
26267
|
this.assertNotInstantiated('overridePipe', 'override pipe metadata');
|
|
26337
26268
|
this.compiler.overridePipe(pipe, override);
|
|
26269
|
+
return this;
|
|
26338
26270
|
}
|
|
26339
26271
|
/**
|
|
26340
26272
|
* Overwrites all providers for the given token with the given provider definition.
|
|
@@ -26342,6 +26274,10 @@ class TestBedRender3 {
|
|
|
26342
26274
|
overrideProvider(token, provider) {
|
|
26343
26275
|
this.assertNotInstantiated('overrideProvider', 'override provider');
|
|
26344
26276
|
this.compiler.overrideProvider(token, provider);
|
|
26277
|
+
return this;
|
|
26278
|
+
}
|
|
26279
|
+
overrideTemplate(component, template) {
|
|
26280
|
+
return this.overrideComponent(component, { set: { template, templateUrl: null } });
|
|
26345
26281
|
}
|
|
26346
26282
|
createComponent(type) {
|
|
26347
26283
|
const testComponentRenderer = this.inject(TestComponentRenderer);
|
|
@@ -26406,10 +26342,10 @@ class TestBedRender3 {
|
|
|
26406
26342
|
checkGlobalCompilationFinished() {
|
|
26407
26343
|
// Checking _testNgModuleRef is null should not be necessary, but is left in as an additional
|
|
26408
26344
|
// guard that compilations queued in tests (after instantiation) are never flushed accidentally.
|
|
26409
|
-
if (!this.
|
|
26345
|
+
if (!this.globalCompilationChecked && this._testModuleRef === null) {
|
|
26410
26346
|
ɵflushModuleScopingQueueAsMuchAsPossible();
|
|
26411
26347
|
}
|
|
26412
|
-
this.
|
|
26348
|
+
this.globalCompilationChecked = true;
|
|
26413
26349
|
}
|
|
26414
26350
|
destroyActiveFixtures() {
|
|
26415
26351
|
let errorCount = 0;
|
|
@@ -26434,7 +26370,7 @@ class TestBedRender3 {
|
|
|
26434
26370
|
shouldRethrowTeardownErrors() {
|
|
26435
26371
|
var _a, _b;
|
|
26436
26372
|
const instanceOptions = this._instanceTeardownOptions;
|
|
26437
|
-
const environmentOptions =
|
|
26373
|
+
const environmentOptions = TestBedImpl._environmentTeardownOptions;
|
|
26438
26374
|
// If the new teardown behavior hasn't been configured, preserve the old behavior.
|
|
26439
26375
|
if (!instanceOptions && !environmentOptions) {
|
|
26440
26376
|
return TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT;
|
|
@@ -26445,16 +26381,16 @@ class TestBedRender3 {
|
|
|
26445
26381
|
shouldThrowErrorOnUnknownElements() {
|
|
26446
26382
|
var _a, _b;
|
|
26447
26383
|
// Check if a configuration has been provided to throw when an unknown element is found
|
|
26448
|
-
return (_b = (_a = this._instanceErrorOnUnknownElementsOption) !== null && _a !== void 0 ? _a :
|
|
26384
|
+
return (_b = (_a = this._instanceErrorOnUnknownElementsOption) !== null && _a !== void 0 ? _a : TestBedImpl._environmentErrorOnUnknownElementsOption) !== null && _b !== void 0 ? _b : THROW_ON_UNKNOWN_ELEMENTS_DEFAULT;
|
|
26449
26385
|
}
|
|
26450
26386
|
shouldThrowErrorOnUnknownProperties() {
|
|
26451
26387
|
var _a, _b;
|
|
26452
26388
|
// Check if a configuration has been provided to throw when an unknown property is found
|
|
26453
|
-
return (_b = (_a = this._instanceErrorOnUnknownPropertiesOption) !== null && _a !== void 0 ? _a :
|
|
26389
|
+
return (_b = (_a = this._instanceErrorOnUnknownPropertiesOption) !== null && _a !== void 0 ? _a : TestBedImpl._environmentErrorOnUnknownPropertiesOption) !== null && _b !== void 0 ? _b : THROW_ON_UNKNOWN_PROPERTIES_DEFAULT;
|
|
26454
26390
|
}
|
|
26455
26391
|
shouldTearDownTestingModule() {
|
|
26456
26392
|
var _a, _b, _c, _d;
|
|
26457
|
-
return (_d = (_b = (_a = this._instanceTeardownOptions) === null || _a === void 0 ? void 0 : _a.destroyAfterEach) !== null && _b !== void 0 ? _b : (_c =
|
|
26393
|
+
return (_d = (_b = (_a = this._instanceTeardownOptions) === null || _a === void 0 ? void 0 : _a.destroyAfterEach) !== null && _b !== void 0 ? _b : (_c = TestBedImpl._environmentTeardownOptions) === null || _c === void 0 ? void 0 : _c.destroyAfterEach) !== null && _d !== void 0 ? _d : TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT;
|
|
26458
26394
|
}
|
|
26459
26395
|
tearDownTestingModule() {
|
|
26460
26396
|
var _a;
|
|
@@ -26484,18 +26420,7 @@ class TestBedRender3 {
|
|
|
26484
26420
|
}
|
|
26485
26421
|
}
|
|
26486
26422
|
}
|
|
26487
|
-
|
|
26488
|
-
function _getTestBedRender3() {
|
|
26489
|
-
return testBed = testBed || new TestBedRender3();
|
|
26490
|
-
}
|
|
26491
|
-
|
|
26492
|
-
/**
|
|
26493
|
-
* @license
|
|
26494
|
-
* Copyright Google LLC All Rights Reserved.
|
|
26495
|
-
*
|
|
26496
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
26497
|
-
* found in the LICENSE file at https://angular.io/license
|
|
26498
|
-
*/
|
|
26423
|
+
TestBedImpl._INSTANCE = null;
|
|
26499
26424
|
/**
|
|
26500
26425
|
* @description
|
|
26501
26426
|
* Configures and initializes environment for unit testing and provides methods for
|
|
@@ -26503,20 +26428,9 @@ function _getTestBedRender3() {
|
|
|
26503
26428
|
*
|
|
26504
26429
|
* `TestBed` is the primary api for writing unit tests for Angular applications and libraries.
|
|
26505
26430
|
*
|
|
26506
|
-
* Note: Use `TestBed` in tests. It will be set to either `TestBedViewEngine` or `TestBedRender3`
|
|
26507
|
-
* according to the compiler used.
|
|
26508
|
-
*
|
|
26509
|
-
* @publicApi
|
|
26510
|
-
*/
|
|
26511
|
-
const TestBed = TestBedRender3;
|
|
26512
|
-
/**
|
|
26513
|
-
* Returns a singleton of the applicable `TestBed`.
|
|
26514
|
-
*
|
|
26515
|
-
* It will be either an instance of `TestBedViewEngine` or `TestBedRender3`.
|
|
26516
|
-
*
|
|
26517
26431
|
* @publicApi
|
|
26518
26432
|
*/
|
|
26519
|
-
const
|
|
26433
|
+
const TestBed = TestBedImpl;
|
|
26520
26434
|
/**
|
|
26521
26435
|
* Allows injecting dependencies in `beforeEach()` and `it()`. Note: this function
|
|
26522
26436
|
* (imported from the `@angular/core/testing` package) can **only** be used to inject dependencies
|
|
@@ -26540,7 +26454,7 @@ const getTestBed = _getTestBedRender3;
|
|
|
26540
26454
|
* @publicApi
|
|
26541
26455
|
*/
|
|
26542
26456
|
function inject(tokens, fn) {
|
|
26543
|
-
const testBed =
|
|
26457
|
+
const testBed = TestBedImpl.INSTANCE;
|
|
26544
26458
|
// Not using an arrow function to preserve context passed from call site
|
|
26545
26459
|
return function () {
|
|
26546
26460
|
return testBed.execute(tokens, fn, this);
|
|
@@ -26556,7 +26470,7 @@ class InjectSetupWrapper {
|
|
|
26556
26470
|
_addModule() {
|
|
26557
26471
|
const moduleDef = this._moduleDef();
|
|
26558
26472
|
if (moduleDef) {
|
|
26559
|
-
|
|
26473
|
+
TestBedImpl.configureTestingModule(moduleDef);
|
|
26560
26474
|
}
|
|
26561
26475
|
}
|
|
26562
26476
|
inject(tokens, fn) {
|
|
@@ -26572,7 +26486,7 @@ function withModule(moduleDef, fn) {
|
|
|
26572
26486
|
if (fn) {
|
|
26573
26487
|
// Not using an arrow function to preserve context passed from call site
|
|
26574
26488
|
return function () {
|
|
26575
|
-
const testBed =
|
|
26489
|
+
const testBed = TestBedImpl.INSTANCE;
|
|
26576
26490
|
if (moduleDef) {
|
|
26577
26491
|
testBed.configureTestingModule(moduleDef);
|
|
26578
26492
|
}
|
|
@@ -26602,9 +26516,9 @@ if (_global.afterEach) {
|
|
|
26602
26516
|
}
|
|
26603
26517
|
function getCleanupHook(expectedTeardownValue) {
|
|
26604
26518
|
return () => {
|
|
26605
|
-
|
|
26606
|
-
if (
|
|
26607
|
-
|
|
26519
|
+
const testBed = TestBedImpl.INSTANCE;
|
|
26520
|
+
if (testBed.shouldTearDownTestingModule() === expectedTeardownValue) {
|
|
26521
|
+
testBed.resetTestingModule();
|
|
26608
26522
|
resetFakeAsyncZone();
|
|
26609
26523
|
}
|
|
26610
26524
|
};
|