angular/packages/core/test/acceptance
Kristiyan Kostadinov 9c55fcb3e6 feat(core): de-duplicate host directives
With host directives we can end up in a situation where the same directive applies multiple times to the same element, potentially with conflicting configurations. The runtime isn't set up for a directive to apply more than once so historically we were throwing an error when we detect duplicates.

This ended up limiting the usefulness of host directives to library authors, because it meant that host directives couldn't be reused as much as authors wanted. To address the issue, these changes introduce logic in the compiler and runtime that will de-duplicate host directives with the following logic:

1. If a directive matches once in the template and more than once as a host directive, the host directive matches will be discarded and only the template match will apply. The mental model is that a host directive match represents `Partial<YourDirective>` while a template match represents the full `YourDirective`.
2. If a directive matches multiple times as a host directive, we merge the input/output mappings from all the instances into a single one. If we detect a case where an input/output is exposed under multiple names during the merging process, both the compiler and the runtime will produce an error.

Fixes #57846.
2026-04-03 09:44:39 -07:00
..
authoring feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
selectorless build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
after_render_effect_spec.ts fix(core): destroying the effect on afterRenderEffect (#63001) 2025-08-08 08:46:46 -07:00
after_render_hook_spec.ts test(core): refactors test to use timeout utility 2026-04-01 20:46:00 +02:00
animation_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
attach_source_locations_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
attributes_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
bootstrap_spec.ts refactor(platform-browser): replace platform-browser-dynamic with platform-browser (#61498) 2025-05-21 14:01:49 +00:00
BUILD.bazel refactor(core): export profile event as enum and move profile_types.ts and framework to shared devtools folder 2025-11-19 15:22:49 -08:00
change_detection_signals_in_zones_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
change_detection_spec.ts test(core): refactors test to use timeout utility 2026-04-01 20:46:00 +02:00
change_detection_transplanted_view_spec.ts test(core): refactors test to use timeout utility 2026-04-01 20:46:00 +02:00
chrome_dev_tools_performance_spec.ts refactor(core): let the profiler handle asymmetric events leniently 2025-11-20 12:29:59 -05:00
common_integration_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
component_spec.ts build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00
content_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
control_flow_for_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
control_flow_if_spec.ts test(core): Adds and uses a waitFor helper 2026-03-03 09:11:22 -08:00
control_flow_switch_spec.ts test(core): Adds and uses a waitFor helper 2026-03-03 09:11:22 -08:00
control_flow_utils_spec.ts refactor(core): abstract control flow discovery utilities (#66167) 2026-03-16 14:17:25 -07:00
create_component_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
csp_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
defer_spec.ts refactor(core): address review comments on NG0750 error message 2026-04-02 14:55:42 -07:00
destroy_ref_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
di_forward_ref_spec.ts refactor(core): update error message links to versioned docs (#66374) 2026-01-09 22:33:51 +00:00
di_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
directive_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
discover_utils_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
embedded_views_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
env_injector_standalone_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
environment_injector_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
exports_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
hmr_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
host_binding_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
host_directives_spec.ts feat(core): de-duplicate host directives 2026-04-03 09:44:39 -07:00
i18n_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
inherit_definition_feature_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
injector_profiler_spec.ts build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00
integration_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
internal_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
let_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
lifecycle_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
listener_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
local_compilation_spec.ts build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00
ng_module_spec.ts refactor(platform-browser): replace platform-browser-dynamic with platform-browser (#61498) 2025-05-21 14:01:49 +00:00
ngmodule_scope_spec.ts refactor(platform-browser): replace platform-browser-dynamic with platform-browser (#61498) 2025-05-21 14:01:49 +00:00
outputs_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
pending_tasks_spec.ts fix(core): Microtask scheduling should be used after any application synchronization 2025-12-16 13:34:48 -08:00
pipe_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
profiler_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
property_binding_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
property_interpolation_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
providers_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
pure_function_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
query_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
renderer_factory_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
router_integration_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
security_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
signal_debug_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
standalone_injector_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
standalone_spec.ts fix(compiler): throw on invalid in expressions 2026-02-23 13:35:07 -08:00
styling_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
template_ref_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
text_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
tracing_spec.ts refactor(core): add tracing for component creation 2026-03-06 09:48:23 -08:00
view_container_ref_spec.ts refactor(core): remove ComponentFactoryResolver & ComponentFactory from the api surface 2026-04-02 16:00:57 -07:00
view_insertion_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
view_ref_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00