@angular/core 20.0.0-next.4 → 20.0.0-next.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/api.d-mxcXqDpA.d.ts +297 -0
- package/discovery.d-CyYpOJ7j.d.ts +7393 -0
- package/{event_dispatcher.d-pVP0-wST.d.ts → event_dispatcher.d-PWnbqZDx.d.ts} +3 -2
- package/fesm2022/attribute-B17mgaqe.mjs +24 -0
- package/fesm2022/attribute-B17mgaqe.mjs.map +1 -0
- package/fesm2022/core.mjs +580 -36869
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node-xKpCIZm-.mjs +32070 -0
- package/fesm2022/debug_node-xKpCIZm-.mjs.map +1 -0
- package/fesm2022/primitives/di.mjs +18 -4
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -16
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +5 -3
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource-BPpYEDic.mjs +621 -0
- package/fesm2022/resource-BPpYEDic.mjs.map +1 -0
- package/fesm2022/root_effect_scheduler-D0_b1cf_.mjs +3816 -0
- package/fesm2022/root_effect_scheduler-D0_b1cf_.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +91 -7
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/{untracked-DkcXpNb_.mjs → signal-DhRAAi7R.mjs} +16 -114
- package/fesm2022/signal-DhRAAi7R.mjs.map +1 -0
- package/fesm2022/testing.mjs +105 -103
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked-DaaW3JJm.mjs +117 -0
- package/fesm2022/untracked-DaaW3JJm.mjs.map +1 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs +12 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs.map +1 -0
- package/{weak_ref.d-BZ7gyRag.d.ts → graph.d-StYigYp1.d.ts} +3 -24
- package/index.d.ts +2520 -10803
- package/ng_i18n_closure_mode.d-DLxSUiDr.d.ts +832 -0
- package/package.json +3 -3
- package/primitives/di/index.d.ts +3 -2
- package/primitives/event-dispatch/index.d.ts +3 -3
- package/primitives/signals/index.d.ts +8 -4
- package/rxjs-interop/index.d.ts +16 -4
- package/schematics/bundles/{apply_import_manager-CeNv8GIG.js → apply_import_manager-C-ysxahq.js} +3 -3
- package/schematics/bundles/{compiler_host-DwM3ugW3.js → change_tracker-0Ktek5Xl.js} +3 -121
- package/schematics/bundles/checker-DqUKCGda.js +17702 -0
- package/schematics/bundles/cleanup-unused-imports.js +6 -5
- package/schematics/bundles/{checker-k591b6WQ.js → compiler-CuoiHqkc.js} +366 -17992
- package/schematics/bundles/compiler_host-CAfDJO3W.js +129 -0
- package/schematics/bundles/control-flow-migration.js +28 -40
- package/schematics/bundles/document-core.js +96 -0
- package/schematics/bundles/imports-CIX-JgAN.js +1 -1
- package/schematics/bundles/{index-BhELUmYx.js → index-CwFQSYXZ.js} +30 -29
- package/schematics/bundles/{index-B4OAlHh8.js → index-WFXCe5Q0.js} +527 -524
- package/schematics/bundles/inject-flags.js +6 -5
- package/schematics/bundles/inject-migration.js +29 -10
- package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Be0TNYen.js → migrate_ts_type_references-BNuHufqZ.js} +6 -5
- package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
- package/schematics/bundles/nodes-B16H9JUd.js +1 -1
- package/schematics/bundles/output-migration.js +15 -10
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
- package/schematics/bundles/route-lazy-loading.js +7 -5
- package/schematics/bundles/{run_in_devkit-CkvEksWP.js → run_in_devkit-CmHxABFr.js} +4 -3
- package/schematics/bundles/self-closing-tags-migration.js +10 -9
- package/schematics/bundles/signal-input-migration.js +8 -7
- package/schematics/bundles/signal-queries-migration.js +27 -14
- package/schematics/bundles/signals.js +8 -7
- package/schematics/bundles/standalone-migration.js +11 -9
- package/schematics/bundles/symbol-VPWguRxr.js +1 -1
- package/schematics/bundles/test-bed-get.js +5 -4
- package/schematics/collection.json +0 -6
- package/schematics/migrations.json +11 -0
- package/signal.d-BeaTIeOE.d.ts +31 -0
- package/testing/index.d.ts +13 -9
- package/weak_ref.d-ttyj86RV.d.ts +9 -0
- package/fesm2022/injector-BlLwZ2sr.mjs +0 -24
- package/fesm2022/injector-BlLwZ2sr.mjs.map +0 -1
- package/fesm2022/untracked-DkcXpNb_.mjs.map +0 -1
- package/navigation_types.d-DgDrF5rp.d.ts +0 -121
- package/schematics/ng-generate/control-flow-migration/schema.json +0 -20
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.5
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import * as i0 from '@angular/core';
|
|
8
|
-
import { ɵDeferBlockState as _DeferBlockState, ɵtriggerResourceLoading as _triggerResourceLoading, ɵrenderDeferBlockState as _renderDeferBlockState, ɵCONTAINER_HEADER_OFFSET as _CONTAINER_HEADER_OFFSET, ɵgetDeferBlocks as _getDeferBlocks, InjectionToken, ɵDeferBlockBehavior as _DeferBlockBehavior, inject as inject$1, NgZone, ErrorHandler, Injectable, ɵNoopNgZone as _NoopNgZone, ApplicationRef, ɵPendingTasksInternal as _PendingTasksInternal, ɵZONELESS_ENABLED as _ZONELESS_ENABLED, ɵChangeDetectionScheduler as _ChangeDetectionScheduler, ɵEffectScheduler as _EffectScheduler, getDebugNode, RendererFactory2, ɵstringify as _stringify, Pipe, Directive, Component, NgModule, ɵReflectionCapabilities as _ReflectionCapabilities, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT as _USE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker as _depsTracker, ɵgetInjectableDef as _getInjectableDef, resolveForwardRef, ɵisComponentDefPendingResolution as _isComponentDefPendingResolution, ɵgetAsyncClassMetadataFn as _getAsyncClassMetadataFn, ɵresolveComponentResources as _resolveComponentResources, ɵRender3NgModuleRef as _Render3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID as _DEFAULT_LOCALE_ID, ɵsetLocaleId as _setLocaleId, ɵRender3ComponentFactory as _Render3ComponentFactory, ɵNG_COMP_DEF as _NG_COMP_DEF, ɵcompileComponent as _compileComponent, ɵNG_DIR_DEF as _NG_DIR_DEF, ɵcompileDirective as _compileDirective, ɵNG_PIPE_DEF as _NG_PIPE_DEF, ɵcompilePipe as _compilePipe, ɵNG_MOD_DEF as _NG_MOD_DEF, ɵpatchComponentDefWithScope as _patchComponentDefWithScope, ɵNG_INJ_DEF as _NG_INJ_DEF, ɵcompileNgModuleDefs as _compileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue as _clearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue as _restoreComponentResolutionQueue, ɵinternalProvideZoneChangeDetection as _internalProvideZoneChangeDetection, ɵChangeDetectionSchedulerImpl as _ChangeDetectionSchedulerImpl, Compiler, ɵDEFER_BLOCK_CONFIG as _DEFER_BLOCK_CONFIG, ɵINTERNAL_APPLICATION_ERROR_HANDLER as _INTERNAL_APPLICATION_ERROR_HANDLER, COMPILER_OPTIONS, Injector, ɵtransitiveScopesFor as _transitiveScopesFor, ɵgenerateStandaloneInDeclarationsError as _generateStandaloneInDeclarationsError, ɵNgModuleFactory as _NgModuleFactory, ModuleWithComponentFactories, ɵisEnvironmentProviders as _isEnvironmentProviders, ɵsetAllowDuplicateNgModuleIdsForTest as _setAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents as _resetCompiledComponents, ɵsetUnknownElementStrictMode as _setUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode as _setUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode as _getUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode as _getUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, ɵflushModuleScopingQueueAsMuchAsPossible as _flushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
9
|
-
export { ɵDeferBlockBehavior as DeferBlockBehavior, ɵDeferBlockState as DeferBlockState } from '@angular/core';
|
|
10
7
|
import { Subscription } from 'rxjs';
|
|
8
|
+
import { D as DeferBlockState, t as triggerResourceLoading, r as renderDeferBlockState, g as getDeferBlocks, a as DeferBlockBehavior, N as NgZone, I as Injectable, b as NoopNgZone, A as ApplicationRef, c as getDebugNode, R as RendererFactory2, P as Pipe, d as Directive, C as Component, e as NgModule, f as ReflectionCapabilities, h as depsTracker, i as isComponentDefPendingResolution, j as getAsyncClassMetadataFn, k as resolveComponentResources, l as NgModuleRef, m as ApplicationInitStatus, L as LOCALE_ID, n as DEFAULT_LOCALE_ID, s as setLocaleId, o as ComponentFactory, p as compileComponent, q as compileDirective, u as compilePipe, v as patchComponentDefWithScope, w as compileNgModuleDefs, x as clearResolutionOfComponentResourcesQueue, y as restoreComponentResolutionQueue, z as internalProvideZoneChangeDetection, B as ChangeDetectionSchedulerImpl, E as Compiler, F as DEFER_BLOCK_CONFIG, G as COMPILER_OPTIONS, H as transitiveScopesFor, J as generateStandaloneInDeclarationsError, K as NgModuleFactory, M as ModuleWithComponentFactories, O as resetCompiledComponents, ɵ as _setUnknownElementStrictMode, Q as _setUnknownPropertyStrictMode, S as _getUnknownElementStrictMode, T as _getUnknownPropertyStrictMode, U as flushModuleScopingQueueAsMuchAsPossible, V as setAllowDuplicateNgModuleIdsForTest } from './debug_node-xKpCIZm-.mjs';
|
|
9
|
+
import { l as CONTAINER_HEADER_OFFSET, j as InjectionToken, i as inject$1, E as ErrorHandler, o as PendingTasksInternal, Z as ZONELESS_ENABLED, C as ChangeDetectionScheduler, c as EffectScheduler, p as stringify, q as getInjectableDef, r as resolveForwardRef, t as NG_COMP_DEF, u as NG_DIR_DEF, v as NG_PIPE_DEF, w as NG_INJ_DEF, x as NG_MOD_DEF, y as INTERNAL_APPLICATION_ERROR_HANDLER, I as Injector, z as isEnvironmentProviders, A as runInInjectionContext, B as EnvironmentInjector } from './root_effect_scheduler-D0_b1cf_.mjs';
|
|
10
|
+
import * as i0 from '@angular/core';
|
|
11
11
|
import { ResourceLoader } from '@angular/compiler';
|
|
12
|
+
import './signal-DhRAAi7R.mjs';
|
|
13
|
+
import '@angular/core/primitives/signals';
|
|
14
|
+
import 'rxjs/operators';
|
|
15
|
+
import './attribute-B17mgaqe.mjs';
|
|
16
|
+
import './primitives/di.mjs';
|
|
17
|
+
import '@angular/core/primitives/di';
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
20
|
* Wraps a test function in an asynchronous test zone. The test will automatically
|
|
@@ -68,13 +74,13 @@ class DeferBlockFixture {
|
|
|
68
74
|
throw new Error(`Tried to render this defer block in the \`${stateAsString}\` state, ` +
|
|
69
75
|
`but there was no @${stateAsString.toLowerCase()} block defined in a template.`);
|
|
70
76
|
}
|
|
71
|
-
if (state ===
|
|
72
|
-
await
|
|
77
|
+
if (state === DeferBlockState.Complete) {
|
|
78
|
+
await triggerResourceLoading(this.block.tDetails, this.block.lView, this.block.tNode);
|
|
73
79
|
}
|
|
74
80
|
// If the `render` method is used explicitly - skip timer-based scheduling for
|
|
75
81
|
// `@placeholder` and `@loading` blocks and render them immediately.
|
|
76
82
|
const skipTimerScheduling = true;
|
|
77
|
-
|
|
83
|
+
renderDeferBlockState(state, this.block.tNode, this.block.lContainer, skipTimerScheduling);
|
|
78
84
|
this.componentFixture.detectChanges();
|
|
79
85
|
}
|
|
80
86
|
/**
|
|
@@ -87,9 +93,9 @@ class DeferBlockFixture {
|
|
|
87
93
|
// located right after an LContainer header. Get a hold of that view and inspect
|
|
88
94
|
// it for nested defer blocks.
|
|
89
95
|
const deferBlockFixtures = [];
|
|
90
|
-
if (this.block.lContainer.length >=
|
|
91
|
-
const lView = this.block.lContainer[
|
|
92
|
-
|
|
96
|
+
if (this.block.lContainer.length >= CONTAINER_HEADER_OFFSET) {
|
|
97
|
+
const lView = this.block.lContainer[CONTAINER_HEADER_OFFSET];
|
|
98
|
+
getDeferBlocks(lView, deferBlocks);
|
|
93
99
|
for (const block of deferBlocks) {
|
|
94
100
|
deferBlockFixtures.push(new DeferBlockFixture(block, this.componentFixture));
|
|
95
101
|
}
|
|
@@ -99,13 +105,13 @@ class DeferBlockFixture {
|
|
|
99
105
|
}
|
|
100
106
|
function hasStateTemplate(state, block) {
|
|
101
107
|
switch (state) {
|
|
102
|
-
case
|
|
108
|
+
case DeferBlockState.Placeholder:
|
|
103
109
|
return block.tDetails.placeholderTmplIndex !== null;
|
|
104
|
-
case
|
|
110
|
+
case DeferBlockState.Loading:
|
|
105
111
|
return block.tDetails.loadingTmplIndex !== null;
|
|
106
|
-
case
|
|
112
|
+
case DeferBlockState.Error:
|
|
107
113
|
return block.tDetails.errorTmplIndex !== null;
|
|
108
|
-
case
|
|
114
|
+
case DeferBlockState.Complete:
|
|
109
115
|
return true;
|
|
110
116
|
default:
|
|
111
117
|
return false;
|
|
@@ -113,11 +119,11 @@ function hasStateTemplate(state, block) {
|
|
|
113
119
|
}
|
|
114
120
|
function getDeferBlockStateNameFromEnum(state) {
|
|
115
121
|
switch (state) {
|
|
116
|
-
case
|
|
122
|
+
case DeferBlockState.Placeholder:
|
|
117
123
|
return 'Placeholder';
|
|
118
|
-
case
|
|
124
|
+
case DeferBlockState.Loading:
|
|
119
125
|
return 'Loading';
|
|
120
|
-
case
|
|
126
|
+
case DeferBlockState.Error:
|
|
121
127
|
return 'Error';
|
|
122
128
|
default:
|
|
123
129
|
return 'Main';
|
|
@@ -131,7 +137,7 @@ const THROW_ON_UNKNOWN_ELEMENTS_DEFAULT = false;
|
|
|
131
137
|
/** Whether unknown properties in templates should throw by default. */
|
|
132
138
|
const THROW_ON_UNKNOWN_PROPERTIES_DEFAULT = false;
|
|
133
139
|
/** Whether defer blocks should use manual triggering or play through normally. */
|
|
134
|
-
const DEFER_BLOCK_DEFAULT_BEHAVIOR =
|
|
140
|
+
const DEFER_BLOCK_DEFAULT_BEHAVIOR = DeferBlockBehavior.Playthrough;
|
|
135
141
|
/**
|
|
136
142
|
* An abstract class for inserting the root test component element in a platform independent way.
|
|
137
143
|
*
|
|
@@ -214,7 +220,7 @@ class ComponentFixture {
|
|
|
214
220
|
/** @internal */
|
|
215
221
|
_noZoneOptionIsSet = inject$1(ComponentFixtureNoNgZone, { optional: true });
|
|
216
222
|
/** @internal */
|
|
217
|
-
_ngZone = this._noZoneOptionIsSet ? new
|
|
223
|
+
_ngZone = this._noZoneOptionIsSet ? new NoopNgZone() : inject$1(NgZone);
|
|
218
224
|
// Inject ApplicationRef to ensure NgZone stableness causes after render hooks to run
|
|
219
225
|
// This will likely happen as a result of fixture.detectChanges because it calls ngZone.run
|
|
220
226
|
// This is a crazy way of doing things but hey, it's the world we live in.
|
|
@@ -224,11 +230,11 @@ class ComponentFixture {
|
|
|
224
230
|
/** @internal */
|
|
225
231
|
_appRef = inject$1(ApplicationRef);
|
|
226
232
|
_testAppRef = this._appRef;
|
|
227
|
-
pendingTasks = inject$1(
|
|
233
|
+
pendingTasks = inject$1(PendingTasksInternal);
|
|
228
234
|
appErrorHandler = inject$1(TestBedApplicationErrorHandler);
|
|
229
|
-
zonelessEnabled = inject$1(
|
|
230
|
-
scheduler = inject$1(
|
|
231
|
-
rootEffectScheduler = inject$1(
|
|
235
|
+
zonelessEnabled = inject$1(ZONELESS_ENABLED);
|
|
236
|
+
scheduler = inject$1(ChangeDetectionScheduler);
|
|
237
|
+
rootEffectScheduler = inject$1(EffectScheduler);
|
|
232
238
|
autoDetectDefault = this.zonelessEnabled ? true : false;
|
|
233
239
|
autoDetect = inject$1(ComponentFixtureAutoDetect, { optional: true }) ?? this.autoDetectDefault;
|
|
234
240
|
subscriptions = new Subscription();
|
|
@@ -340,7 +346,7 @@ class ComponentFixture {
|
|
|
340
346
|
* yet.
|
|
341
347
|
*/
|
|
342
348
|
isStable() {
|
|
343
|
-
return !this.pendingTasks.hasPendingTasks
|
|
349
|
+
return !this.pendingTasks.hasPendingTasks;
|
|
344
350
|
}
|
|
345
351
|
/**
|
|
346
352
|
* Get a promise that resolves when the fixture is stable.
|
|
@@ -366,7 +372,7 @@ class ComponentFixture {
|
|
|
366
372
|
getDeferBlocks() {
|
|
367
373
|
const deferBlocks = [];
|
|
368
374
|
const lView = this.componentRef.hostView['_lView'];
|
|
369
|
-
|
|
375
|
+
getDeferBlocks(lView, deferBlocks);
|
|
370
376
|
const deferBlockFixtures = [];
|
|
371
377
|
for (const block of deferBlocks) {
|
|
372
378
|
deferBlockFixtures.push(new DeferBlockFixture(block, this));
|
|
@@ -579,7 +585,7 @@ class MetadataOverrider {
|
|
|
579
585
|
}
|
|
580
586
|
if (override.set) {
|
|
581
587
|
if (override.remove || override.add) {
|
|
582
|
-
throw new Error(`Cannot set and add/remove ${
|
|
588
|
+
throw new Error(`Cannot set and add/remove ${stringify(metadataClass)} at the same time!`);
|
|
583
589
|
}
|
|
584
590
|
setMetadata(props, override.set);
|
|
585
591
|
}
|
|
@@ -658,7 +664,7 @@ function _propHashKey(propName, propValue, references) {
|
|
|
658
664
|
function _serializeReference(ref, references) {
|
|
659
665
|
let id = references.get(ref);
|
|
660
666
|
if (!id) {
|
|
661
|
-
id = `${
|
|
667
|
+
id = `${stringify(ref)}${_nextReferenceId++}`;
|
|
662
668
|
references.set(ref, id);
|
|
663
669
|
}
|
|
664
670
|
return id;
|
|
@@ -684,7 +690,7 @@ function _valueProps(obj) {
|
|
|
684
690
|
return props;
|
|
685
691
|
}
|
|
686
692
|
|
|
687
|
-
const reflection = new
|
|
693
|
+
const reflection = new ReflectionCapabilities();
|
|
688
694
|
/**
|
|
689
695
|
* Allows to override ivy metadata for tests (via the `TestBed`).
|
|
690
696
|
*/
|
|
@@ -771,10 +777,10 @@ function isTestingModuleOverride(value) {
|
|
|
771
777
|
}
|
|
772
778
|
function assertNoStandaloneComponents(types, resolver, location) {
|
|
773
779
|
types.forEach((type) => {
|
|
774
|
-
if (!
|
|
780
|
+
if (!getAsyncClassMetadataFn(type)) {
|
|
775
781
|
const component = resolver.resolve(type);
|
|
776
782
|
if (component && (component.standalone == null || component.standalone)) {
|
|
777
|
-
throw new Error(
|
|
783
|
+
throw new Error(generateStandaloneInDeclarationsError(type, location));
|
|
778
784
|
}
|
|
779
785
|
}
|
|
780
786
|
});
|
|
@@ -869,8 +875,8 @@ class TestBedCompiler {
|
|
|
869
875
|
moduleDef.rethrowApplicationErrors ?? RETHROW_APPLICATION_ERRORS_DEFAULT;
|
|
870
876
|
}
|
|
871
877
|
overrideModule(ngModule, override) {
|
|
872
|
-
|
|
873
|
-
|
|
878
|
+
{
|
|
879
|
+
depsTracker.clearScopeCacheFor(ngModule);
|
|
874
880
|
}
|
|
875
881
|
this.overriddenModules.add(ngModule);
|
|
876
882
|
// Compile the module right away.
|
|
@@ -927,7 +933,7 @@ class TestBedCompiler {
|
|
|
927
933
|
else {
|
|
928
934
|
providerDef = { provide: token };
|
|
929
935
|
}
|
|
930
|
-
const injectableDef = typeof token !== 'string' ?
|
|
936
|
+
const injectableDef = typeof token !== 'string' ? getInjectableDef(token) : null;
|
|
931
937
|
const providedIn = injectableDef === null ? null : resolveForwardRef(injectableDef.providedIn);
|
|
932
938
|
const overridesBucket = providedIn === 'root' ? this.rootProviderOverrides : this.providerOverrides;
|
|
933
939
|
overridesBucket.push(providerDef);
|
|
@@ -944,12 +950,12 @@ class TestBedCompiler {
|
|
|
944
950
|
}
|
|
945
951
|
}
|
|
946
952
|
overrideTemplateUsingTestingModule(type, template) {
|
|
947
|
-
const def = type[
|
|
953
|
+
const def = type[NG_COMP_DEF];
|
|
948
954
|
const hasStyleUrls = () => {
|
|
949
955
|
const metadata = this.resolvers.component.resolve(type);
|
|
950
956
|
return !!metadata.styleUrl || !!metadata.styleUrls?.length;
|
|
951
957
|
};
|
|
952
|
-
const overrideStyleUrls = !!def && !
|
|
958
|
+
const overrideStyleUrls = !!def && !isComponentDefPendingResolution(type) && hasStyleUrls();
|
|
953
959
|
// In Ivy, compiling a component does not require knowing the module providing the
|
|
954
960
|
// component's scope, so overrideTemplateUsingTestingModule can be implemented purely via
|
|
955
961
|
// overrideComponent. Important: overriding template requires full Component re-compilation,
|
|
@@ -972,7 +978,7 @@ class TestBedCompiler {
|
|
|
972
978
|
return;
|
|
973
979
|
const promises = [];
|
|
974
980
|
for (const component of this.componentsWithAsyncMetadata) {
|
|
975
|
-
const asyncMetadataFn =
|
|
981
|
+
const asyncMetadataFn = getAsyncClassMetadataFn(component);
|
|
976
982
|
if (asyncMetadataFn) {
|
|
977
983
|
promises.push(asyncMetadataFn());
|
|
978
984
|
}
|
|
@@ -1009,7 +1015,7 @@ class TestBedCompiler {
|
|
|
1009
1015
|
}
|
|
1010
1016
|
return Promise.resolve(resourceLoader.get(url));
|
|
1011
1017
|
};
|
|
1012
|
-
await
|
|
1018
|
+
await resolveComponentResources(resolver);
|
|
1013
1019
|
}
|
|
1014
1020
|
}
|
|
1015
1021
|
finalize() {
|
|
@@ -1026,15 +1032,15 @@ class TestBedCompiler {
|
|
|
1026
1032
|
// every component.
|
|
1027
1033
|
this.componentToModuleScope.clear();
|
|
1028
1034
|
const parentInjector = this.platform.injector;
|
|
1029
|
-
this.testModuleRef = new
|
|
1035
|
+
this.testModuleRef = new NgModuleRef(this.testModuleType, parentInjector, []);
|
|
1030
1036
|
// ApplicationInitStatus.runInitializers() is marked @internal to core.
|
|
1031
1037
|
// Cast it to any before accessing it.
|
|
1032
1038
|
this.testModuleRef.injector.get(ApplicationInitStatus).runInitializers();
|
|
1033
1039
|
// Set locale ID after running app initializers, since locale information might be updated while
|
|
1034
1040
|
// running initializers. This is also consistent with the execution order while bootstrapping an
|
|
1035
1041
|
// app (see `packages/core/src/application_ref.ts` file).
|
|
1036
|
-
const localeId = this.testModuleRef.injector.get(LOCALE_ID,
|
|
1037
|
-
|
|
1042
|
+
const localeId = this.testModuleRef.injector.get(LOCALE_ID, DEFAULT_LOCALE_ID);
|
|
1043
|
+
setLocaleId(localeId);
|
|
1038
1044
|
return this.testModuleRef;
|
|
1039
1045
|
}
|
|
1040
1046
|
/**
|
|
@@ -1069,7 +1075,7 @@ class TestBedCompiler {
|
|
|
1069
1075
|
_getComponentFactories(moduleType) {
|
|
1070
1076
|
return maybeUnwrapFn(moduleType.ɵmod.declarations).reduce((factories, declaration) => {
|
|
1071
1077
|
const componentDef = declaration.ɵcmp;
|
|
1072
|
-
componentDef && factories.push(new
|
|
1078
|
+
componentDef && factories.push(new ComponentFactory(componentDef, this.testModuleRef));
|
|
1073
1079
|
return factories;
|
|
1074
1080
|
}, []);
|
|
1075
1081
|
}
|
|
@@ -1077,20 +1083,20 @@ class TestBedCompiler {
|
|
|
1077
1083
|
// Compile all queued components, directives, pipes.
|
|
1078
1084
|
let needsAsyncResources = false;
|
|
1079
1085
|
this.pendingComponents.forEach((declaration) => {
|
|
1080
|
-
if (
|
|
1086
|
+
if (getAsyncClassMetadataFn(declaration)) {
|
|
1081
1087
|
throw new Error(`Component '${declaration.name}' has unresolved metadata. ` +
|
|
1082
1088
|
`Please call \`await TestBed.compileComponents()\` before running this test.`);
|
|
1083
1089
|
}
|
|
1084
|
-
needsAsyncResources = needsAsyncResources ||
|
|
1090
|
+
needsAsyncResources = needsAsyncResources || isComponentDefPendingResolution(declaration);
|
|
1085
1091
|
const metadata = this.resolvers.component.resolve(declaration);
|
|
1086
1092
|
if (metadata === null) {
|
|
1087
1093
|
throw invalidTypeError(declaration.name, 'Component');
|
|
1088
1094
|
}
|
|
1089
|
-
this.maybeStoreNgDef(
|
|
1090
|
-
|
|
1091
|
-
|
|
1095
|
+
this.maybeStoreNgDef(NG_COMP_DEF, declaration);
|
|
1096
|
+
{
|
|
1097
|
+
depsTracker.clearScopeCacheFor(declaration);
|
|
1092
1098
|
}
|
|
1093
|
-
|
|
1099
|
+
compileComponent(declaration, metadata);
|
|
1094
1100
|
});
|
|
1095
1101
|
this.pendingComponents.clear();
|
|
1096
1102
|
this.pendingDirectives.forEach((declaration) => {
|
|
@@ -1098,8 +1104,8 @@ class TestBedCompiler {
|
|
|
1098
1104
|
if (metadata === null) {
|
|
1099
1105
|
throw invalidTypeError(declaration.name, 'Directive');
|
|
1100
1106
|
}
|
|
1101
|
-
this.maybeStoreNgDef(
|
|
1102
|
-
|
|
1107
|
+
this.maybeStoreNgDef(NG_DIR_DEF, declaration);
|
|
1108
|
+
compileDirective(declaration, metadata);
|
|
1103
1109
|
});
|
|
1104
1110
|
this.pendingDirectives.clear();
|
|
1105
1111
|
this.pendingPipes.forEach((declaration) => {
|
|
@@ -1107,8 +1113,8 @@ class TestBedCompiler {
|
|
|
1107
1113
|
if (metadata === null) {
|
|
1108
1114
|
throw invalidTypeError(declaration.name, 'Pipe');
|
|
1109
1115
|
}
|
|
1110
|
-
this.maybeStoreNgDef(
|
|
1111
|
-
|
|
1116
|
+
this.maybeStoreNgDef(NG_PIPE_DEF, declaration);
|
|
1117
|
+
compilePipe(declaration, metadata);
|
|
1112
1118
|
});
|
|
1113
1119
|
this.pendingPipes.clear();
|
|
1114
1120
|
return needsAsyncResources;
|
|
@@ -1118,16 +1124,12 @@ class TestBedCompiler {
|
|
|
1118
1124
|
// Module overrides (via `TestBed.overrideModule`) might affect scopes that were previously
|
|
1119
1125
|
// calculated and stored in `transitiveCompileScopes`. If module overrides are present,
|
|
1120
1126
|
// collect all affected modules and reset scopes to force their re-calculation.
|
|
1121
|
-
const testingModuleDef = this.testModuleType[
|
|
1127
|
+
const testingModuleDef = this.testModuleType[NG_MOD_DEF];
|
|
1122
1128
|
const affectedModules = this.collectModulesAffectedByOverrides(testingModuleDef.imports);
|
|
1123
1129
|
if (affectedModules.size > 0) {
|
|
1124
1130
|
affectedModules.forEach((moduleType) => {
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
moduleType[_NG_MOD_DEF].transitiveCompileScopes = null;
|
|
1128
|
-
}
|
|
1129
|
-
else {
|
|
1130
|
-
_depsTracker.clearScopeCacheFor(moduleType);
|
|
1131
|
+
{
|
|
1132
|
+
depsTracker.clearScopeCacheFor(moduleType);
|
|
1131
1133
|
}
|
|
1132
1134
|
});
|
|
1133
1135
|
}
|
|
@@ -1137,16 +1139,16 @@ class TestBedCompiler {
|
|
|
1137
1139
|
if (!moduleToScope.has(moduleType)) {
|
|
1138
1140
|
const isTestingModule = isTestingModuleOverride(moduleType);
|
|
1139
1141
|
const realType = isTestingModule ? this.testModuleType : moduleType;
|
|
1140
|
-
moduleToScope.set(moduleType,
|
|
1142
|
+
moduleToScope.set(moduleType, transitiveScopesFor(realType));
|
|
1141
1143
|
}
|
|
1142
1144
|
return moduleToScope.get(moduleType);
|
|
1143
1145
|
};
|
|
1144
1146
|
this.componentToModuleScope.forEach((moduleType, componentType) => {
|
|
1145
1147
|
if (moduleType !== null) {
|
|
1146
1148
|
const moduleScope = getScopeOfModule(moduleType);
|
|
1147
|
-
this.storeFieldOfDefOnType(componentType,
|
|
1148
|
-
this.storeFieldOfDefOnType(componentType,
|
|
1149
|
-
|
|
1149
|
+
this.storeFieldOfDefOnType(componentType, NG_COMP_DEF, 'directiveDefs');
|
|
1150
|
+
this.storeFieldOfDefOnType(componentType, NG_COMP_DEF, 'pipeDefs');
|
|
1151
|
+
patchComponentDefWithScope(getComponentDef(componentType), moduleScope);
|
|
1150
1152
|
}
|
|
1151
1153
|
// `tView` that is stored on component def contains information about directives and pipes
|
|
1152
1154
|
// that are in the scope of this component. Patching component scope will cause `tView` to be
|
|
@@ -1155,20 +1157,20 @@ class TestBedCompiler {
|
|
|
1155
1157
|
// Resetting `tView` is also needed for cases when we apply provider overrides and those
|
|
1156
1158
|
// providers are defined on component's level, in which case they may end up included into
|
|
1157
1159
|
// `tView.blueprint`.
|
|
1158
|
-
this.storeFieldOfDefOnType(componentType,
|
|
1160
|
+
this.storeFieldOfDefOnType(componentType, NG_COMP_DEF, 'tView');
|
|
1159
1161
|
});
|
|
1160
1162
|
this.componentToModuleScope.clear();
|
|
1161
1163
|
}
|
|
1162
1164
|
applyProviderOverrides() {
|
|
1163
1165
|
const maybeApplyOverrides = (field) => (type) => {
|
|
1164
|
-
const resolver = field ===
|
|
1166
|
+
const resolver = field === NG_COMP_DEF ? this.resolvers.component : this.resolvers.directive;
|
|
1165
1167
|
const metadata = resolver.resolve(type);
|
|
1166
1168
|
if (this.hasProviderOverrides(metadata.providers)) {
|
|
1167
1169
|
this.patchDefWithProviderOverrides(type, field);
|
|
1168
1170
|
}
|
|
1169
1171
|
};
|
|
1170
|
-
this.seenComponents.forEach(maybeApplyOverrides(
|
|
1171
|
-
this.seenDirectives.forEach(maybeApplyOverrides(
|
|
1172
|
+
this.seenComponents.forEach(maybeApplyOverrides(NG_COMP_DEF));
|
|
1173
|
+
this.seenDirectives.forEach(maybeApplyOverrides(NG_DIR_DEF));
|
|
1172
1174
|
this.seenComponents.clear();
|
|
1173
1175
|
this.seenDirectives.clear();
|
|
1174
1176
|
}
|
|
@@ -1191,7 +1193,7 @@ class TestBedCompiler {
|
|
|
1191
1193
|
// detailed error messages. The fact that the code relies on this line being
|
|
1192
1194
|
// present here is suspicious and should be refactored in a way that the line
|
|
1193
1195
|
// below can be moved (for ex. after an early exit check below).
|
|
1194
|
-
const injectorDef = type[
|
|
1196
|
+
const injectorDef = type[NG_INJ_DEF];
|
|
1195
1197
|
// No provider overrides, exit early.
|
|
1196
1198
|
if (this.providerOverridesByToken.size === 0)
|
|
1197
1199
|
return;
|
|
@@ -1209,12 +1211,12 @@ class TestBedCompiler {
|
|
|
1209
1211
|
...(this.providerOverridesByModule.get(type) || []),
|
|
1210
1212
|
];
|
|
1211
1213
|
if (this.hasProviderOverrides(providers)) {
|
|
1212
|
-
this.maybeStoreNgDef(
|
|
1213
|
-
this.storeFieldOfDefOnType(type,
|
|
1214
|
+
this.maybeStoreNgDef(NG_INJ_DEF, type);
|
|
1215
|
+
this.storeFieldOfDefOnType(type, NG_INJ_DEF, 'providers');
|
|
1214
1216
|
injectorDef.providers = this.getOverriddenProviders(providers);
|
|
1215
1217
|
}
|
|
1216
1218
|
// Apply provider overrides to imported modules recursively
|
|
1217
|
-
const moduleDef = type[
|
|
1219
|
+
const moduleDef = type[NG_MOD_DEF];
|
|
1218
1220
|
const imports = maybeUnwrapFn(moduleDef.imports);
|
|
1219
1221
|
for (const importedModule of imports) {
|
|
1220
1222
|
this.applyProviderOverridesInScope(importedModule);
|
|
@@ -1234,7 +1236,7 @@ class TestBedCompiler {
|
|
|
1234
1236
|
}
|
|
1235
1237
|
}
|
|
1236
1238
|
patchComponentsWithExistingStyles() {
|
|
1237
|
-
this.existingComponentStyles.forEach((styles, type) => (type[
|
|
1239
|
+
this.existingComponentStyles.forEach((styles, type) => (type[NG_COMP_DEF].styles = styles));
|
|
1238
1240
|
this.existingComponentStyles.clear();
|
|
1239
1241
|
}
|
|
1240
1242
|
queueTypeArray(arr, moduleType) {
|
|
@@ -1249,12 +1251,12 @@ class TestBedCompiler {
|
|
|
1249
1251
|
}
|
|
1250
1252
|
recompileNgModule(ngModule, metadata) {
|
|
1251
1253
|
// Cache the initial ngModuleDef as it will be overwritten.
|
|
1252
|
-
this.maybeStoreNgDef(
|
|
1253
|
-
this.maybeStoreNgDef(
|
|
1254
|
-
|
|
1254
|
+
this.maybeStoreNgDef(NG_MOD_DEF, ngModule);
|
|
1255
|
+
this.maybeStoreNgDef(NG_INJ_DEF, ngModule);
|
|
1256
|
+
compileNgModuleDefs(ngModule, metadata);
|
|
1255
1257
|
}
|
|
1256
1258
|
maybeRegisterComponentWithAsyncMetadata(type) {
|
|
1257
|
-
const asyncMetadataFn =
|
|
1259
|
+
const asyncMetadataFn = getAsyncClassMetadataFn(type);
|
|
1258
1260
|
if (asyncMetadataFn) {
|
|
1259
1261
|
this.componentsWithAsyncMetadata.add(type);
|
|
1260
1262
|
}
|
|
@@ -1268,7 +1270,7 @@ class TestBedCompiler {
|
|
|
1268
1270
|
// Check whether a give Type has respective NG def (ɵcmp) and compile if def is
|
|
1269
1271
|
// missing. That might happen in case a class without any Angular decorators extends another
|
|
1270
1272
|
// class where Component/Directive/Pipe decorator is defined.
|
|
1271
|
-
if (
|
|
1273
|
+
if (isComponentDefPendingResolution(type) || !type.hasOwnProperty(NG_COMP_DEF)) {
|
|
1272
1274
|
this.pendingComponents.add(type);
|
|
1273
1275
|
}
|
|
1274
1276
|
this.seenComponents.add(type);
|
|
@@ -1295,14 +1297,14 @@ class TestBedCompiler {
|
|
|
1295
1297
|
}
|
|
1296
1298
|
const directive = this.resolvers.directive.resolve(type);
|
|
1297
1299
|
if (directive) {
|
|
1298
|
-
if (!type.hasOwnProperty(
|
|
1300
|
+
if (!type.hasOwnProperty(NG_DIR_DEF)) {
|
|
1299
1301
|
this.pendingDirectives.add(type);
|
|
1300
1302
|
}
|
|
1301
1303
|
this.seenDirectives.add(type);
|
|
1302
1304
|
return;
|
|
1303
1305
|
}
|
|
1304
1306
|
const pipe = this.resolvers.pipe.resolve(type);
|
|
1305
|
-
if (pipe && !type.hasOwnProperty(
|
|
1307
|
+
if (pipe && !type.hasOwnProperty(NG_PIPE_DEF)) {
|
|
1306
1308
|
this.pendingPipes.add(type);
|
|
1307
1309
|
return;
|
|
1308
1310
|
}
|
|
@@ -1390,7 +1392,7 @@ class TestBedCompiler {
|
|
|
1390
1392
|
path.forEach((item) => affectedModules.add(item));
|
|
1391
1393
|
}
|
|
1392
1394
|
// Examine module imports recursively to look for overridden modules.
|
|
1393
|
-
const moduleDef = value[
|
|
1395
|
+
const moduleDef = value[NG_MOD_DEF];
|
|
1394
1396
|
calcAffectedModulesRecur(maybeUnwrapFn(moduleDef.imports), path.concat(value));
|
|
1395
1397
|
}
|
|
1396
1398
|
}
|
|
@@ -1428,7 +1430,7 @@ class TestBedCompiler {
|
|
|
1428
1430
|
if (this.originalComponentResolutionQueue === null) {
|
|
1429
1431
|
this.originalComponentResolutionQueue = new Map();
|
|
1430
1432
|
}
|
|
1431
|
-
|
|
1433
|
+
clearResolutionOfComponentResourcesQueue().forEach((value, key) => this.originalComponentResolutionQueue.set(key, value));
|
|
1432
1434
|
}
|
|
1433
1435
|
/*
|
|
1434
1436
|
* Restores component resolution queue to the previously saved state. This operation is performed
|
|
@@ -1437,7 +1439,7 @@ class TestBedCompiler {
|
|
|
1437
1439
|
*/
|
|
1438
1440
|
restoreComponentResolutionQueue() {
|
|
1439
1441
|
if (this.originalComponentResolutionQueue !== null) {
|
|
1440
|
-
|
|
1442
|
+
restoreComponentResolutionQueue(this.originalComponentResolutionQueue);
|
|
1441
1443
|
this.originalComponentResolutionQueue = null;
|
|
1442
1444
|
}
|
|
1443
1445
|
}
|
|
@@ -1449,8 +1451,8 @@ class TestBedCompiler {
|
|
|
1449
1451
|
});
|
|
1450
1452
|
// Restore initial component/directive/pipe defs
|
|
1451
1453
|
this.initialNgDefs.forEach((defs, type) => {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
+
{
|
|
1455
|
+
depsTracker.clearScopeCacheFor(type);
|
|
1454
1456
|
}
|
|
1455
1457
|
defs.forEach((descriptor, prop) => {
|
|
1456
1458
|
if (!descriptor) {
|
|
@@ -1471,24 +1473,24 @@ class TestBedCompiler {
|
|
|
1471
1473
|
this.scopesWithOverriddenProviders.clear();
|
|
1472
1474
|
this.restoreComponentResolutionQueue();
|
|
1473
1475
|
// Restore the locale ID to the default value, this shouldn't be necessary but we never know
|
|
1474
|
-
|
|
1476
|
+
setLocaleId(DEFAULT_LOCALE_ID);
|
|
1475
1477
|
}
|
|
1476
1478
|
compileTestModule() {
|
|
1477
1479
|
class RootScopeModule {
|
|
1478
1480
|
}
|
|
1479
|
-
|
|
1481
|
+
compileNgModuleDefs(RootScopeModule, {
|
|
1480
1482
|
providers: [
|
|
1481
1483
|
...this.rootProviderOverrides,
|
|
1482
|
-
|
|
1484
|
+
internalProvideZoneChangeDetection({}),
|
|
1483
1485
|
TestBedApplicationErrorHandler,
|
|
1484
|
-
{ provide:
|
|
1486
|
+
{ provide: ChangeDetectionScheduler, useExisting: ChangeDetectionSchedulerImpl },
|
|
1485
1487
|
],
|
|
1486
1488
|
});
|
|
1487
1489
|
const providers = [
|
|
1488
1490
|
{ provide: Compiler, useFactory: () => new R3TestCompiler(this) },
|
|
1489
|
-
{ provide:
|
|
1491
|
+
{ provide: DEFER_BLOCK_CONFIG, useValue: { behavior: this.deferBlockBehavior } },
|
|
1490
1492
|
{
|
|
1491
|
-
provide:
|
|
1493
|
+
provide: INTERNAL_APPLICATION_ERROR_HANDLER,
|
|
1492
1494
|
useFactory: () => {
|
|
1493
1495
|
if (this.rethrowApplicationTickErrors) {
|
|
1494
1496
|
const handler = inject$1(TestBedApplicationErrorHandler);
|
|
@@ -1507,7 +1509,7 @@ class TestBedCompiler {
|
|
|
1507
1509
|
...this.providerOverrides,
|
|
1508
1510
|
];
|
|
1509
1511
|
const imports = [RootScopeModule, this.additionalModuleTypes, this.imports || []];
|
|
1510
|
-
|
|
1512
|
+
compileNgModuleDefs(this.testModuleType, {
|
|
1511
1513
|
declarations: this.declarations,
|
|
1512
1514
|
imports,
|
|
1513
1515
|
schemas: this.schemas,
|
|
@@ -1633,7 +1635,7 @@ function identityFn(value) {
|
|
|
1633
1635
|
function flattenProviders(providers, mapFn = identityFn) {
|
|
1634
1636
|
const out = [];
|
|
1635
1637
|
for (let provider of providers) {
|
|
1636
|
-
if (
|
|
1638
|
+
if (isEnvironmentProviders(provider)) {
|
|
1637
1639
|
provider = provider.ɵproviders;
|
|
1638
1640
|
}
|
|
1639
1641
|
if (Array.isArray(provider)) {
|
|
@@ -1669,11 +1671,11 @@ class R3TestCompiler {
|
|
|
1669
1671
|
}
|
|
1670
1672
|
compileModuleSync(moduleType) {
|
|
1671
1673
|
this.testBed._compileNgModuleSync(moduleType);
|
|
1672
|
-
return new
|
|
1674
|
+
return new NgModuleFactory(moduleType);
|
|
1673
1675
|
}
|
|
1674
1676
|
async compileModuleAsync(moduleType) {
|
|
1675
1677
|
await this.testBed._compileNgModuleAsync(moduleType);
|
|
1676
|
-
return new
|
|
1678
|
+
return new NgModuleFactory(moduleType);
|
|
1677
1679
|
}
|
|
1678
1680
|
compileModuleAndAllComponentsSync(moduleType) {
|
|
1679
1681
|
const ngModuleFactory = this.compileModuleSync(moduleType);
|
|
@@ -1839,7 +1841,7 @@ class TestBedImpl {
|
|
|
1839
1841
|
/**
|
|
1840
1842
|
* Runs the given function in the `EnvironmentInjector` context of `TestBed`.
|
|
1841
1843
|
*
|
|
1842
|
-
* @see {@link EnvironmentInjector#runInContext}
|
|
1844
|
+
* @see {@link https://angular.dev/api/core/EnvironmentInjector#runInContext}
|
|
1843
1845
|
*/
|
|
1844
1846
|
static runInInjectionContext(fn) {
|
|
1845
1847
|
return TestBedImpl.INSTANCE.runInInjectionContext(fn);
|
|
@@ -1901,7 +1903,7 @@ class TestBedImpl {
|
|
|
1901
1903
|
// used to track the state of the NgModule registry and reset it correctly. Instead, when we
|
|
1902
1904
|
// know we're in a testing scenario, we disable the check for duplicate NgModule registration
|
|
1903
1905
|
// completely.
|
|
1904
|
-
|
|
1906
|
+
setAllowDuplicateNgModuleIdsForTest(true);
|
|
1905
1907
|
}
|
|
1906
1908
|
/**
|
|
1907
1909
|
* Reset the providers for the test injector.
|
|
@@ -1914,11 +1916,11 @@ class TestBedImpl {
|
|
|
1914
1916
|
this.platform = null;
|
|
1915
1917
|
this.ngModule = null;
|
|
1916
1918
|
TestBedImpl._environmentTeardownOptions = undefined;
|
|
1917
|
-
|
|
1919
|
+
setAllowDuplicateNgModuleIdsForTest(false);
|
|
1918
1920
|
}
|
|
1919
1921
|
resetTestingModule() {
|
|
1920
1922
|
this.checkGlobalCompilationFinished();
|
|
1921
|
-
|
|
1923
|
+
resetCompiledComponents();
|
|
1922
1924
|
if (this._compiler !== null) {
|
|
1923
1925
|
this.compiler.restoreOriginalState();
|
|
1924
1926
|
}
|
|
@@ -2040,15 +2042,15 @@ class TestBedImpl {
|
|
|
2040
2042
|
const testComponentRenderer = this.inject(TestComponentRenderer);
|
|
2041
2043
|
const rootElId = `root${_nextRootElementId++}`;
|
|
2042
2044
|
testComponentRenderer.insertRootElement(rootElId);
|
|
2043
|
-
if (
|
|
2045
|
+
if (getAsyncClassMetadataFn(type)) {
|
|
2044
2046
|
throw new Error(`Component '${type.name}' has unresolved metadata. ` +
|
|
2045
2047
|
`Please call \`await TestBed.compileComponents()\` before running this test.`);
|
|
2046
2048
|
}
|
|
2047
2049
|
const componentDef = type.ɵcmp;
|
|
2048
2050
|
if (!componentDef) {
|
|
2049
|
-
throw new Error(`It looks like '${
|
|
2051
|
+
throw new Error(`It looks like '${stringify(type)}' has not been compiled.`);
|
|
2050
2052
|
}
|
|
2051
|
-
const componentFactory = new
|
|
2053
|
+
const componentFactory = new ComponentFactory(componentDef);
|
|
2052
2054
|
const initComponent = () => {
|
|
2053
2055
|
const componentRef = componentFactory.create(Injector.NULL, [], `#${rootElId}`, this.testModuleRef);
|
|
2054
2056
|
return this.runInInjectionContext(() => new ComponentFixture(componentRef));
|
|
@@ -2101,7 +2103,7 @@ class TestBedImpl {
|
|
|
2101
2103
|
// Checking _testNgModuleRef is null should not be necessary, but is left in as an additional
|
|
2102
2104
|
// guard that compilations queued in tests (after instantiation) are never flushed accidentally.
|
|
2103
2105
|
if (!this.globalCompilationChecked && this._testModuleRef === null) {
|
|
2104
|
-
|
|
2106
|
+
flushModuleScopingQueueAsMuchAsPossible();
|
|
2105
2107
|
}
|
|
2106
2108
|
this.globalCompilationChecked = true;
|
|
2107
2109
|
}
|
|
@@ -2189,7 +2191,7 @@ class TestBedImpl {
|
|
|
2189
2191
|
* @developerPreview
|
|
2190
2192
|
*/
|
|
2191
2193
|
flushEffects() {
|
|
2192
|
-
this.inject(
|
|
2194
|
+
this.inject(EffectScheduler).flush();
|
|
2193
2195
|
}
|
|
2194
2196
|
}
|
|
2195
2197
|
/**
|
|
@@ -3153,5 +3155,5 @@ class InternalNavigationResult {
|
|
|
3153
3155
|
}
|
|
3154
3156
|
}
|
|
3155
3157
|
|
|
3156
|
-
export { ComponentFixture, ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, DeferBlockFixture, InjectSetupWrapper, TestBed, TestComponentRenderer, __core_private_testing_placeholder__, discardPeriodicTasks, fakeAsync, flush, flushMicrotasks, getTestBed, inject, resetFakeAsyncZone, tick, waitForAsync, withModule, FakeNavigation as ɵFakeNavigation, MetadataOverrider as ɵMetadataOverrider };
|
|
3158
|
+
export { ComponentFixture, ComponentFixtureAutoDetect, ComponentFixtureNoNgZone, DeferBlockBehavior, DeferBlockFixture, DeferBlockState, InjectSetupWrapper, TestBed, TestComponentRenderer, __core_private_testing_placeholder__, discardPeriodicTasks, fakeAsync, flush, flushMicrotasks, getTestBed, inject, resetFakeAsyncZone, tick, waitForAsync, withModule, FakeNavigation as ɵFakeNavigation, MetadataOverrider as ɵMetadataOverrider };
|
|
3157
3159
|
//# sourceMappingURL=testing.mjs.map
|