@angular/core 17.0.4 → 17.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/esm2022/src/application_init.mjs +2 -2
- package/esm2022/src/render3/features/host_directives_feature.mjs +20 -13
- package/esm2022/src/render3/instructions/change_detection.mjs +3 -4
- package/esm2022/src/render3/util/view_utils.mjs +11 -12
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/esm2022/testing/src/test_bed.mjs +3 -3
- package/esm2022/testing/src/test_bed_compiler.mjs +19 -10
- package/fesm2022/core.mjs +32 -27
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +21 -12
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +3 -3
- package/package.json +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/block-template-entities/bundle.js +307 -302
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/migrations/compiler-options/bundle.js +13 -13
- package/schematics/migrations/transfer-state/bundle.js +13 -13
- package/schematics/ng-generate/control-flow-migration/bundle.js +510 -382
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +571 -560
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.
|
|
2
|
+
* @license Angular v17.0.5
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, getDebugNode, RendererFactory2, InjectionToken, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵgenerateStandaloneInDeclarationsError, ɵDeferBlockBehavior, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, provideZoneChangeDetection, Compiler, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, EnvironmentInjector, NgZone, ɵZoneAwareQueueingScheduler, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
7
|
+
import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, getDebugNode, RendererFactory2, InjectionToken, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵgenerateStandaloneInDeclarationsError, ɵDeferBlockBehavior, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, provideZoneChangeDetection, Compiler, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, NgZone, ɵZoneAwareQueueingScheduler, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
8
8
|
export { ɵDeferBlockBehavior as DeferBlockBehavior, ɵDeferBlockState as DeferBlockState } from '@angular/core';
|
|
9
9
|
import { ResourceLoader } from '@angular/compiler';
|
|
10
10
|
|
|
@@ -753,6 +753,13 @@ class TestBedCompiler {
|
|
|
753
753
|
// defined at the same time.
|
|
754
754
|
this.existingComponentStyles = new Map();
|
|
755
755
|
this.resolvers = initResolvers();
|
|
756
|
+
// Map of component type to an NgModule that declares it.
|
|
757
|
+
//
|
|
758
|
+
// There are a couple special cases:
|
|
759
|
+
// - for standalone components, the module scope value is `null`
|
|
760
|
+
// - when a component is declared in `TestBed.configureTestingModule()` call or
|
|
761
|
+
// a component's template is overridden via `TestBed.overrideTemplateUsingTestingModule()`.
|
|
762
|
+
// we use a special value from the `TestingModuleOverride` enum.
|
|
756
763
|
this.componentToModuleScope = new Map();
|
|
757
764
|
// Map that keeps initial version of component/directive/pipe defs in case
|
|
758
765
|
// we compile a Type again, thus overriding respective static fields. This is
|
|
@@ -1064,15 +1071,20 @@ class TestBedCompiler {
|
|
|
1064
1071
|
return moduleToScope.get(moduleType);
|
|
1065
1072
|
};
|
|
1066
1073
|
this.componentToModuleScope.forEach((moduleType, componentType) => {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1074
|
+
if (moduleType !== null) {
|
|
1075
|
+
const moduleScope = getScopeOfModule(moduleType);
|
|
1076
|
+
this.storeFieldOfDefOnType(componentType, ɵNG_COMP_DEF, 'directiveDefs');
|
|
1077
|
+
this.storeFieldOfDefOnType(componentType, ɵNG_COMP_DEF, 'pipeDefs');
|
|
1078
|
+
ɵpatchComponentDefWithScope(getComponentDef(componentType), moduleScope);
|
|
1079
|
+
}
|
|
1070
1080
|
// `tView` that is stored on component def contains information about directives and pipes
|
|
1071
1081
|
// that are in the scope of this component. Patching component scope will cause `tView` to be
|
|
1072
1082
|
// changed. Store original `tView` before patching scope, so the `tView` (including scope
|
|
1073
1083
|
// information) is restored back to its previous/original state before running next test.
|
|
1084
|
+
// Resetting `tView` is also needed for cases when we apply provider overrides and those
|
|
1085
|
+
// providers are defined on component's level, in which case they may end up included into
|
|
1086
|
+
// `tView.blueprint`.
|
|
1074
1087
|
this.storeFieldOfDefOnType(componentType, ɵNG_COMP_DEF, 'tView');
|
|
1075
|
-
ɵpatchComponentDefWithScope(componentType.ɵcmp, moduleScope);
|
|
1076
1088
|
});
|
|
1077
1089
|
this.componentToModuleScope.clear();
|
|
1078
1090
|
}
|
|
@@ -1195,11 +1207,8 @@ class TestBedCompiler {
|
|
|
1195
1207
|
// real module, which was imported. This pattern is understood to mean that the component
|
|
1196
1208
|
// should use its original scope, but that the testing module should also contain the
|
|
1197
1209
|
// component in its scope.
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
if (moduleType !== null &&
|
|
1201
|
-
(!this.componentToModuleScope.has(type) ||
|
|
1202
|
-
this.componentToModuleScope.get(type) === TestingModuleOverride.DECLARATION)) {
|
|
1210
|
+
if ((!this.componentToModuleScope.has(type) ||
|
|
1211
|
+
this.componentToModuleScope.get(type) === TestingModuleOverride.DECLARATION)) {
|
|
1203
1212
|
this.componentToModuleScope.set(type, moduleType);
|
|
1204
1213
|
}
|
|
1205
1214
|
return;
|
|
@@ -1852,7 +1861,7 @@ class TestBedImpl {
|
|
|
1852
1861
|
return this.inject(token, notFoundValue, flags);
|
|
1853
1862
|
}
|
|
1854
1863
|
runInInjectionContext(fn) {
|
|
1855
|
-
return this.inject(EnvironmentInjector)
|
|
1864
|
+
return runInInjectionContext(this.inject(EnvironmentInjector), fn);
|
|
1856
1865
|
}
|
|
1857
1866
|
execute(tokens, fn, context) {
|
|
1858
1867
|
const params = tokens.map(t => this.inject(t));
|