angular/packages/core/test/acceptance
Andrew Kushnir 822439fddd fix(core): ViewContainerRef.createComponent should consult module injector when custom one is provided (#44966)
Before Ivy, it was only possible to call the `ViewContainerRef.createComponent` function with the ComponentFactory as the first argument. An instance of a `ComponentFactory` resolved via `ComponentFactoryResolver` contained a reference to an `NgModule` where the component is declared. As a result, the component maintained a DI connection with the module injector tree (by retrieving an instance of `NgModuleRef` internally), even when the custom injector was provided (we try to find a token in a custom injector first and consult module injector after that).

With Ivy, we expanded the `ViewContainerRef.createComponent` function API to support direct references to the Component classes without going through the factory resolution step. As a result, there was no connection to the NgModule that declares the component. Thus, if you provide a custom injector, this is the only injector that is taken into account.

This commit updates the logic for the factory-less case to try retrieving an instance of an `NgModuleRef` using the DI tree which `ViewContainerRef` belongs to. The `NgModuleRef` instance is then used to get a hold of a module injector tree. This brings the factory-less and factory-based logic to more consistent state.

Closes #44897.

PR Close #44966
2022-02-08 09:57:20 -08:00
..
attributes_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
bootstrap_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
BUILD.bazel test: update acceptance core tests to work with es2015 (#44505) 2022-01-05 23:20:21 +00:00
change_detection_spec.ts test(core): clean up tests relying on entryComponents (#44276) 2021-11-29 12:36:04 -05:00
change_detection_transplanted_view_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
common_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_spec.ts test(core): clean up tests relying on entryComponents (#44276) 2021-11-29 12:36:04 -05:00
content_spec.ts build: bundle spec files for saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
copy_definition_feature_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
debug_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
di_forward_ref_spec.ts test: update acceptance core tests to work with es2015 (#44505) 2022-01-05 23:20:21 +00:00
di_spec.ts Revert "feat(core): allow for injector to be specified when creating an embedded view (#44666)" (#44807) 2022-01-24 12:22:22 -08:00
directive_spec.ts refactor: fix various typos across different packages (#44523) 2022-01-07 18:11:10 +00:00
discover_utils_spec.ts build: bundle spec files for saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
embedded_views_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
exports_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
host_binding_spec.ts test(core): clean up tests relying on entryComponents (#44276) 2021-11-29 12:36:04 -05:00
i18n_spec.ts fix(core): consistently use namespace short name rather than URI (#44766) 2022-01-21 11:19:30 -08:00
inherit_definition_feature_spec.ts refactor(core): make the error messages tree shakable (#44359) 2022-01-18 17:38:10 -08:00
integration_spec.ts perf(animations): Remove generic objects in favor of Maps (#44482) 2022-01-31 20:28:43 +00:00
lifecycle_spec.ts test(core): clean up tests relying on entryComponents (#44276) 2021-11-29 12:36:04 -05:00
listener_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
ng_module_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
ngdevmode_debug_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
ngmodule_scope_spec.ts fix(core): prevent NgModule scope being overwritten in JIT compiler (#37795) 2020-08-11 09:50:27 -07:00
outputs_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
profiler_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
property_binding_spec.ts test: update acceptance core tests to work with es2015 (#44505) 2022-01-05 23:20:21 +00:00
property_interpolation_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
providers_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
pure_function_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
query_spec.ts test: remove Ivy/ViewEngine switch helpers and obsolete tests (#44120) 2021-11-24 19:42:39 +00:00
renderer_factory_spec.ts perf(animations): Remove generic objects in favor of Maps (#44482) 2022-01-31 20:28:43 +00:00
router_integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
security_spec.ts ci: add lint error for files with missing trailing new-line (#42478) 2021-06-04 13:31:03 -07:00
styling_spec.ts test: update acceptance core tests to work with es2015 (#44505) 2022-01-05 23:20:21 +00:00
template_ref_spec.ts test(core): clean up tests relying on entryComponents (#44276) 2021-11-29 12:36:04 -05:00
text_spec.ts build: bundle spec files for saucelabs legacy job (#44281) 2021-11-30 11:56:04 -05:00
view_container_ref_spec.ts fix(core): ViewContainerRef.createComponent should consult module injector when custom one is provided (#44966) 2022-02-08 09:57:20 -08:00
view_insertion_spec.ts test(core): clean up tests relying on entryComponents (#44276) 2021-11-29 12:36:04 -05:00
view_ref_spec.ts test(core): clean up tests relying on entryComponents (#44276) 2021-11-29 12:36:04 -05:00