@angular/core 14.0.0-next.7 → 14.0.0-rc.0
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 +232 -66
- package/esm2020/src/application_tokens.mjs +5 -2
- package/esm2020/src/change_detection/change_detection.mjs +2 -2
- package/esm2020/src/change_detection/change_detector_ref.mjs +3 -3
- package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +3 -3
- package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +3 -3
- package/esm2020/src/change_detection/differs/iterable_differs.mjs +2 -2
- package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +2 -2
- package/esm2020/src/compiler/compiler_facade.mjs +2 -2
- package/esm2020/src/compiler/compiler_facade_interface.mjs +7 -1
- package/esm2020/src/console.mjs +4 -3
- package/esm2020/src/core.mjs +2 -2
- package/esm2020/src/core_private_export.mjs +5 -3
- package/esm2020/src/core_render3_private_export.mjs +5 -4
- package/esm2020/src/debug/debug_node.mjs +5 -5
- package/esm2020/src/di/create_injector.mjs +35 -0
- package/esm2020/src/di/index.mjs +4 -1
- package/esm2020/src/di/initializer_token.mjs +16 -0
- package/esm2020/src/di/injection_token.mjs +7 -1
- package/esm2020/src/di/injector.mjs +3 -3
- package/esm2020/src/di/injector_compatibility.mjs +5 -7
- package/esm2020/src/di/injector_token.mjs +2 -2
- package/esm2020/src/di/interface/defs.mjs +1 -1
- package/esm2020/src/di/interface/provider.mjs +1 -1
- package/esm2020/src/di/internal_tokens.mjs +10 -0
- package/esm2020/src/di/jit/injectable.mjs +3 -3
- package/esm2020/src/di/metadata.mjs +6 -6
- package/esm2020/src/di/provider_collection.mjs +224 -0
- package/esm2020/src/di/r3_injector.mjs +87 -157
- package/esm2020/src/di/reflective_provider.mjs +4 -4
- package/esm2020/src/di/scope.mjs +1 -1
- package/esm2020/src/errors.mjs +1 -1
- package/esm2020/src/linker/component_factory.mjs +1 -1
- package/esm2020/src/linker/ng_module_factory.mjs +1 -1
- package/esm2020/src/linker/ng_module_factory_loader.mjs +2 -2
- package/esm2020/src/linker/ng_module_registration.mjs +55 -0
- package/esm2020/src/linker/template_ref.mjs +3 -3
- package/esm2020/src/linker/view_container_ref.mjs +15 -12
- package/esm2020/src/metadata/directives.mjs +1 -1
- package/esm2020/src/metadata/ng_module.mjs +1 -1
- package/esm2020/src/metadata.mjs +1 -1
- package/esm2020/src/platform_core_providers.mjs +3 -14
- package/esm2020/src/reflection/platform_reflection_capabilities.mjs +1 -1
- package/esm2020/src/reflection/reflection_capabilities.mjs +1 -37
- package/esm2020/src/render3/assert.mjs +3 -3
- package/esm2020/src/render3/bindings.mjs +2 -2
- package/esm2020/src/render3/collect_native_nodes.mjs +5 -5
- package/esm2020/src/render3/component.mjs +8 -8
- package/esm2020/src/render3/component_ref.mjs +15 -7
- package/esm2020/src/render3/context_discovery.mjs +4 -4
- package/esm2020/src/render3/definition.mjs +18 -20
- package/esm2020/src/render3/di.mjs +21 -21
- package/esm2020/src/render3/di_setup.mjs +7 -6
- package/esm2020/src/render3/errors.mjs +22 -4
- package/esm2020/src/render3/errors_di.mjs +10 -7
- package/esm2020/src/render3/features/inherit_definition_feature.mjs +4 -3
- package/esm2020/src/render3/features/standalone_feature.mjs +70 -0
- package/esm2020/src/render3/hooks.mjs +19 -19
- package/esm2020/src/render3/i18n/i18n_apply.mjs +16 -16
- package/esm2020/src/render3/i18n/i18n_debug.mjs +9 -9
- package/esm2020/src/render3/i18n/i18n_insert_before_index.mjs +2 -2
- package/esm2020/src/render3/i18n/i18n_parse.mjs +16 -16
- package/esm2020/src/render3/i18n/i18n_util.mjs +7 -7
- package/esm2020/src/render3/index.mjs +6 -5
- package/esm2020/src/render3/instructions/advance.mjs +4 -4
- package/esm2020/src/render3/instructions/all.mjs +2 -1
- package/esm2020/src/render3/instructions/change_detection.mjs +2 -2
- package/esm2020/src/render3/instructions/element.mjs +47 -12
- package/esm2020/src/render3/instructions/element_container.mjs +3 -3
- package/esm2020/src/render3/instructions/i18n.mjs +2 -2
- package/esm2020/src/render3/instructions/listener.mjs +8 -11
- package/esm2020/src/render3/instructions/lview_debug.mjs +27 -27
- package/esm2020/src/render3/instructions/projection.mjs +3 -3
- package/esm2020/src/render3/instructions/shared.mjs +133 -87
- package/esm2020/src/render3/instructions/styling.mjs +5 -5
- package/esm2020/src/render3/instructions/template.mjs +3 -3
- package/esm2020/src/render3/instructions/text.mjs +2 -2
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/interfaces/node.mjs +10 -10
- package/esm2020/src/render3/interfaces/public_definitions.mjs +1 -1
- package/esm2020/src/render3/interfaces/styling.mjs +18 -18
- package/esm2020/src/render3/interfaces/type_checks.mjs +5 -5
- package/esm2020/src/render3/interfaces/view.mjs +1 -1
- package/esm2020/src/render3/jit/directive.mjs +135 -13
- package/esm2020/src/render3/jit/environment.mjs +5 -1
- package/esm2020/src/render3/jit/module.mjs +90 -27
- package/esm2020/src/render3/jit/module_patch.mjs +11 -0
- package/esm2020/src/render3/jit/partial.mjs +8 -8
- package/esm2020/src/render3/jit/pipe.mjs +4 -6
- package/esm2020/src/render3/jit/util.mjs +15 -0
- package/esm2020/src/render3/ng_module_ref.mjs +34 -32
- package/esm2020/src/render3/node_assert.mjs +8 -8
- package/esm2020/src/render3/node_manipulation.mjs +40 -40
- package/esm2020/src/render3/node_manipulation_i18n.mjs +3 -3
- package/esm2020/src/render3/node_selector_matcher.mjs +28 -28
- package/esm2020/src/render3/pipe.mjs +2 -2
- package/esm2020/src/render3/query.mjs +12 -12
- package/esm2020/src/render3/state.mjs +34 -11
- package/esm2020/src/render3/styling/class_differ.mjs +3 -3
- package/esm2020/src/render3/styling/static_styling.mjs +3 -3
- package/esm2020/src/render3/styling/styling_parser.mjs +18 -18
- package/esm2020/src/render3/util/attrs_utils.mjs +10 -10
- package/esm2020/src/render3/util/discovery_utils.mjs +4 -4
- package/esm2020/src/render3/util/injector_utils.mjs +4 -4
- package/esm2020/src/render3/util/view_traversal_utils.mjs +2 -2
- package/esm2020/src/render3/util/view_utils.mjs +3 -3
- package/esm2020/src/render3/view_ref.mjs +12 -8
- package/esm2020/src/sanitization/bypass.mjs +7 -7
- package/esm2020/src/sanitization/sanitization.mjs +10 -10
- package/esm2020/src/testability/testability.mjs +69 -19
- package/esm2020/src/util/global.mjs +8 -8
- package/esm2020/src/util/raf.mjs +1 -1
- 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/r3_test_bed.mjs +44 -13
- package/esm2020/testing/src/r3_test_bed_compiler.mjs +45 -4
- package/esm2020/testing/src/resolvers.mjs +1 -1
- package/esm2020/testing/src/test_bed.mjs +1 -1
- package/esm2020/testing/src/test_bed_common.mjs +5 -1
- package/fesm2015/core.mjs +1861 -1122
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +94 -15
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +1856 -1123
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +91 -15
- package/fesm2020/testing.mjs.map +1 -1
- package/{core.d.ts → index.d.ts} +14774 -14598
- package/package.json +4 -4
- package/schematics/migrations/path-match-type/index.d.ts +11 -0
- package/schematics/migrations/path-match-type/index.js +95 -0
- package/schematics/migrations/path-match-type/transform.d.ts +19 -0
- package/schematics/migrations/path-match-type/transform.js +48 -0
- package/schematics/migrations/path-match-type/update_recorder.d.ts +18 -0
- package/schematics/migrations/path-match-type/update_recorder.js +20 -0
- package/schematics/migrations/path-match-type/util.d.ts +11 -0
- package/schematics/migrations/path-match-type/util.js +106 -0
- package/schematics/migrations/typed-forms/util.d.ts +2 -1
- package/schematics/migrations/typed-forms/util.js +42 -13
- package/schematics/migrations.json +8 -3
- package/schematics/utils/import_manager.js +3 -15
- package/schematics/utils/typescript/imports.js +2 -7
- package/testing/{testing.d.ts → index.d.ts} +565 -577
- package/esm2020/src/change_detection/change_detection_util.mjs +0 -64
- package/esm2020/src/di/util.mjs +0 -51
- package/esm2020/src/linker/ng_module_factory_registration.mjs +0 -59
- package/esm2020/src/reflection/reflection.mjs +0 -16
- package/esm2020/src/reflection/reflector.mjs +0 -56
- package/esm2020/src/reflection/types.mjs +0 -9
- package/testing/package.json +0 -9
package/fesm2020/testing.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-
|
|
2
|
+
* @license Angular v14.0.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getDebugNode, RendererFactory2, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵ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, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ModuleWithComponentFactories, InjectionToken, Injector, InjectFlags, ɵresetCompiledComponents, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
7
|
+
import { getDebugNode, RendererFactory2, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵ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, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ModuleWithComponentFactories, InjectionToken, Injector, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
8
8
|
import { ResourceLoader } from '@angular/compiler';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -837,17 +837,27 @@ class R3TestBedCompiler {
|
|
|
837
837
|
this.queueTypesFromModulesArray([ngModule]);
|
|
838
838
|
}
|
|
839
839
|
overrideComponent(component, override) {
|
|
840
|
+
this.verifyNoStandaloneFlagOverrides(component, override);
|
|
840
841
|
this.resolvers.component.addOverride(component, override);
|
|
841
842
|
this.pendingComponents.add(component);
|
|
842
843
|
}
|
|
843
844
|
overrideDirective(directive, override) {
|
|
845
|
+
this.verifyNoStandaloneFlagOverrides(directive, override);
|
|
844
846
|
this.resolvers.directive.addOverride(directive, override);
|
|
845
847
|
this.pendingDirectives.add(directive);
|
|
846
848
|
}
|
|
847
849
|
overridePipe(pipe, override) {
|
|
850
|
+
this.verifyNoStandaloneFlagOverrides(pipe, override);
|
|
848
851
|
this.resolvers.pipe.addOverride(pipe, override);
|
|
849
852
|
this.pendingPipes.add(pipe);
|
|
850
853
|
}
|
|
854
|
+
verifyNoStandaloneFlagOverrides(type, override) {
|
|
855
|
+
if (override.add?.hasOwnProperty('standalone') || override.set?.hasOwnProperty('standalone') ||
|
|
856
|
+
override.remove?.hasOwnProperty('standalone')) {
|
|
857
|
+
throw new Error(`An override for the ${type.name} class has the \`standalone\` flag. ` +
|
|
858
|
+
`Changing the \`standalone\` flag via TestBed overrides is not supported.`);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
851
861
|
overrideProvider(token, provider) {
|
|
852
862
|
let providerDef;
|
|
853
863
|
if (provider.useFactory !== undefined) {
|
|
@@ -1066,8 +1076,24 @@ class R3TestBedCompiler {
|
|
|
1066
1076
|
return;
|
|
1067
1077
|
}
|
|
1068
1078
|
this.moduleProvidersOverridden.add(moduleType);
|
|
1079
|
+
// NOTE: the line below triggers JIT compilation of the module injector,
|
|
1080
|
+
// which also invokes verification of the NgModule semantics, which produces
|
|
1081
|
+
// detailed error messages. The fact that the code relies on this line being
|
|
1082
|
+
// present here is suspicious and should be refactored in a way that the line
|
|
1083
|
+
// below can be moved (for ex. after an early exit check below).
|
|
1069
1084
|
const injectorDef = moduleType[ɵNG_INJ_DEF];
|
|
1070
|
-
|
|
1085
|
+
// No provider overrides, exit early.
|
|
1086
|
+
if (this.providerOverridesByToken.size === 0)
|
|
1087
|
+
return;
|
|
1088
|
+
if (isStandaloneComponent(moduleType)) {
|
|
1089
|
+
// Visit all component dependencies and override providers there.
|
|
1090
|
+
const def = getComponentDef(moduleType);
|
|
1091
|
+
const dependencies = maybeUnwrapFn(def.dependencies ?? []);
|
|
1092
|
+
for (const dependency of dependencies) {
|
|
1093
|
+
this.applyProviderOverridesToModule(dependency);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
else {
|
|
1071
1097
|
const providers = [
|
|
1072
1098
|
...injectorDef.providers,
|
|
1073
1099
|
...(this.providerOverridesByModule.get(moduleType) || [])
|
|
@@ -1142,8 +1168,11 @@ class R3TestBedCompiler {
|
|
|
1142
1168
|
// real module, which was imported. This pattern is understood to mean that the component
|
|
1143
1169
|
// should use its original scope, but that the testing module should also contain the
|
|
1144
1170
|
// component in its scope.
|
|
1145
|
-
|
|
1146
|
-
|
|
1171
|
+
//
|
|
1172
|
+
// Note: standalone components have no associated NgModule, so the `moduleType` can be `null`.
|
|
1173
|
+
if (moduleType !== null &&
|
|
1174
|
+
(!this.componentToModuleScope.has(type) ||
|
|
1175
|
+
this.componentToModuleScope.get(type) === TestingModuleOverride.DECLARATION)) {
|
|
1147
1176
|
this.componentToModuleScope.set(type, moduleType);
|
|
1148
1177
|
}
|
|
1149
1178
|
return;
|
|
@@ -1187,6 +1216,11 @@ class R3TestBedCompiler {
|
|
|
1187
1216
|
else if (isModuleWithProviders(value)) {
|
|
1188
1217
|
queueTypesFromModulesArrayRecur([value.ngModule]);
|
|
1189
1218
|
}
|
|
1219
|
+
else if (isStandaloneComponent(value)) {
|
|
1220
|
+
this.queueType(value, null);
|
|
1221
|
+
const def = getComponentDef(value);
|
|
1222
|
+
queueTypesFromModulesArrayRecur(maybeUnwrapFn(def.dependencies ?? []));
|
|
1223
|
+
}
|
|
1190
1224
|
}
|
|
1191
1225
|
};
|
|
1192
1226
|
queueTypesFromModulesArrayRecur(arr);
|
|
@@ -1404,6 +1438,13 @@ function initResolvers() {
|
|
|
1404
1438
|
pipe: new PipeResolver()
|
|
1405
1439
|
};
|
|
1406
1440
|
}
|
|
1441
|
+
function isStandaloneComponent(value) {
|
|
1442
|
+
const def = getComponentDef(value);
|
|
1443
|
+
return !!def?.standalone;
|
|
1444
|
+
}
|
|
1445
|
+
function getComponentDef(value) {
|
|
1446
|
+
return value.ɵcmp ?? null;
|
|
1447
|
+
}
|
|
1407
1448
|
function hasNgModuleDef(value) {
|
|
1408
1449
|
return value.hasOwnProperty('ɵmod');
|
|
1409
1450
|
}
|
|
@@ -1478,6 +1519,10 @@ class R3TestCompiler {
|
|
|
1478
1519
|
*/
|
|
1479
1520
|
/** Whether test modules should be torn down by default. */
|
|
1480
1521
|
const TEARDOWN_TESTING_MODULE_ON_DESTROY_DEFAULT = true;
|
|
1522
|
+
/** Whether unknown elements in templates should throw by default. */
|
|
1523
|
+
const THROW_ON_UNKNOWN_ELEMENTS_DEFAULT = false;
|
|
1524
|
+
/** Whether unknown properties in templates should throw by default. */
|
|
1525
|
+
const THROW_ON_UNKNOWN_PROPERTIES_DEFAULT = false;
|
|
1481
1526
|
/**
|
|
1482
1527
|
* An abstract class for inserting the root test component element in a platform independent way.
|
|
1483
1528
|
*
|
|
@@ -1537,9 +1582,9 @@ class TestBedRender3 {
|
|
|
1537
1582
|
*
|
|
1538
1583
|
* @publicApi
|
|
1539
1584
|
*/
|
|
1540
|
-
static initTestEnvironment(ngModule, platform,
|
|
1585
|
+
static initTestEnvironment(ngModule, platform, options) {
|
|
1541
1586
|
const testBed = _getTestBedRender3();
|
|
1542
|
-
testBed.initTestEnvironment(ngModule, platform,
|
|
1587
|
+
testBed.initTestEnvironment(ngModule, platform, options);
|
|
1543
1588
|
return testBed;
|
|
1544
1589
|
}
|
|
1545
1590
|
/**
|
|
@@ -1637,17 +1682,21 @@ class TestBedRender3 {
|
|
|
1637
1682
|
*
|
|
1638
1683
|
* @publicApi
|
|
1639
1684
|
*/
|
|
1640
|
-
initTestEnvironment(ngModule, platform,
|
|
1685
|
+
initTestEnvironment(ngModule, platform, options) {
|
|
1641
1686
|
if (this.platform || this.ngModule) {
|
|
1642
1687
|
throw new Error('Cannot set base providers because it has already been called');
|
|
1643
1688
|
}
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
TestBedRender3.
|
|
1647
|
-
typeof summariesOrOptions === 'function' ? undefined : summariesOrOptions?.teardown;
|
|
1689
|
+
TestBedRender3._environmentTeardownOptions = options?.teardown;
|
|
1690
|
+
TestBedRender3._environmentErrorOnUnknownElementsOption = options?.errorOnUnknownElements;
|
|
1691
|
+
TestBedRender3._environmentErrorOnUnknownPropertiesOption = options?.errorOnUnknownProperties;
|
|
1648
1692
|
this.platform = platform;
|
|
1649
1693
|
this.ngModule = ngModule;
|
|
1650
1694
|
this._compiler = new R3TestBedCompiler(this.platform, this.ngModule);
|
|
1695
|
+
// TestBed does not have an API which can reliably detect the start of a test, and thus could be
|
|
1696
|
+
// used to track the state of the NgModule registry and reset it correctly. Instead, when we
|
|
1697
|
+
// know we're in a testing scenario, we disable the check for duplicate NgModule registration
|
|
1698
|
+
// completely.
|
|
1699
|
+
ɵsetAllowDuplicateNgModuleIdsForTest(true);
|
|
1651
1700
|
}
|
|
1652
1701
|
/**
|
|
1653
1702
|
* Reset the providers for the test injector.
|
|
@@ -1660,6 +1709,7 @@ class TestBedRender3 {
|
|
|
1660
1709
|
this.platform = null;
|
|
1661
1710
|
this.ngModule = null;
|
|
1662
1711
|
TestBedRender3._environmentTeardownOptions = undefined;
|
|
1712
|
+
ɵsetAllowDuplicateNgModuleIdsForTest(false);
|
|
1663
1713
|
}
|
|
1664
1714
|
resetTestingModule() {
|
|
1665
1715
|
this.checkGlobalCompilationFinished();
|
|
@@ -1668,6 +1718,10 @@ class TestBedRender3 {
|
|
|
1668
1718
|
this.compiler.restoreOriginalState();
|
|
1669
1719
|
}
|
|
1670
1720
|
this._compiler = new R3TestBedCompiler(this.platform, this.ngModule);
|
|
1721
|
+
// Restore the previous value of the "error on unknown elements" option
|
|
1722
|
+
ɵsetUnknownElementStrictMode(this._previousErrorOnUnknownElementsOption ?? THROW_ON_UNKNOWN_ELEMENTS_DEFAULT);
|
|
1723
|
+
// Restore the previous value of the "error on unknown properties" option
|
|
1724
|
+
ɵsetUnknownPropertyStrictMode(this._previousErrorOnUnknownPropertiesOption ?? THROW_ON_UNKNOWN_PROPERTIES_DEFAULT);
|
|
1671
1725
|
// We have to chain a couple of try/finally blocks, because each step can
|
|
1672
1726
|
// throw errors and we don't want it to interrupt the next step and we also
|
|
1673
1727
|
// want an error to be thrown at the end.
|
|
@@ -1683,6 +1737,8 @@ class TestBedRender3 {
|
|
|
1683
1737
|
finally {
|
|
1684
1738
|
this._testModuleRef = null;
|
|
1685
1739
|
this._instanceTeardownOptions = undefined;
|
|
1740
|
+
this._instanceErrorOnUnknownElementsOption = undefined;
|
|
1741
|
+
this._instanceErrorOnUnknownPropertiesOption = undefined;
|
|
1686
1742
|
}
|
|
1687
1743
|
}
|
|
1688
1744
|
}
|
|
@@ -1701,9 +1757,17 @@ class TestBedRender3 {
|
|
|
1701
1757
|
// their components scoped properly. See the `checkGlobalCompilationFinished` function
|
|
1702
1758
|
// description for additional info.
|
|
1703
1759
|
this.checkGlobalCompilationFinished();
|
|
1704
|
-
// Always re-assign the
|
|
1705
|
-
// This ensures that we don't carry
|
|
1760
|
+
// Always re-assign the options, even if they're undefined.
|
|
1761
|
+
// This ensures that we don't carry them between tests.
|
|
1706
1762
|
this._instanceTeardownOptions = moduleDef.teardown;
|
|
1763
|
+
this._instanceErrorOnUnknownElementsOption = moduleDef.errorOnUnknownElements;
|
|
1764
|
+
this._instanceErrorOnUnknownPropertiesOption = moduleDef.errorOnUnknownProperties;
|
|
1765
|
+
// Store the current value of the strict mode option,
|
|
1766
|
+
// so we can restore it later
|
|
1767
|
+
this._previousErrorOnUnknownElementsOption = ɵgetUnknownElementStrictMode();
|
|
1768
|
+
ɵsetUnknownElementStrictMode(this.shouldThrowErrorOnUnknownElements());
|
|
1769
|
+
this._previousErrorOnUnknownPropertiesOption = ɵgetUnknownPropertyStrictMode();
|
|
1770
|
+
ɵsetUnknownPropertyStrictMode(this.shouldThrowErrorOnUnknownProperties());
|
|
1707
1771
|
this.compiler.configureTestingModule(moduleDef);
|
|
1708
1772
|
}
|
|
1709
1773
|
compileComponents() {
|
|
@@ -1759,7 +1823,7 @@ class TestBedRender3 {
|
|
|
1759
1823
|
testComponentRenderer.insertRootElement(rootElId);
|
|
1760
1824
|
const componentDef = type.ɵcmp;
|
|
1761
1825
|
if (!componentDef) {
|
|
1762
|
-
throw new Error(`It looks like '${ɵstringify(type)}' has not been
|
|
1826
|
+
throw new Error(`It looks like '${ɵstringify(type)}' has not been compiled.`);
|
|
1763
1827
|
}
|
|
1764
1828
|
// TODO: Don't cast as `InjectionToken<boolean>`, proper type is boolean[]
|
|
1765
1829
|
const noNgZone = this.inject(ComponentFixtureNoNgZone, false);
|
|
@@ -1852,6 +1916,18 @@ class TestBedRender3 {
|
|
|
1852
1916
|
return instanceOptions?.rethrowErrors ?? environmentOptions?.rethrowErrors ??
|
|
1853
1917
|
this.shouldTearDownTestingModule();
|
|
1854
1918
|
}
|
|
1919
|
+
shouldThrowErrorOnUnknownElements() {
|
|
1920
|
+
// Check if a configuration has been provided to throw when an unknown element is found
|
|
1921
|
+
return this._instanceErrorOnUnknownElementsOption ??
|
|
1922
|
+
TestBedRender3._environmentErrorOnUnknownElementsOption ??
|
|
1923
|
+
THROW_ON_UNKNOWN_ELEMENTS_DEFAULT;
|
|
1924
|
+
}
|
|
1925
|
+
shouldThrowErrorOnUnknownProperties() {
|
|
1926
|
+
// Check if a configuration has been provided to throw when an unknown property is found
|
|
1927
|
+
return this._instanceErrorOnUnknownPropertiesOption ??
|
|
1928
|
+
TestBedRender3._environmentErrorOnUnknownPropertiesOption ??
|
|
1929
|
+
THROW_ON_UNKNOWN_PROPERTIES_DEFAULT;
|
|
1930
|
+
}
|
|
1855
1931
|
shouldTearDownTestingModule() {
|
|
1856
1932
|
return this._instanceTeardownOptions?.destroyAfterEach ??
|
|
1857
1933
|
TestBedRender3._environmentTeardownOptions?.destroyAfterEach ??
|