angular/packages/core/test/acceptance
Jessica Janiuk a4001c440f fix(core): Prevent leave animations on a move operation (#63745)
When a user has `animate.leave` on a list of items in a `@for`, but are only showing a subset using a computed, removing the second to last item results in a move operation on the last item. There's no native atomic move API in the browser. So this results in the element being detached and attached at its new index. The detaching of the node resulted in leave animations firing.
This fix addresses this by adding a flag in the `LView[ANIMATIONS]` `AnimationLViewData` interface to allow for skipping animations. During list reconciliation, we set this flag so that the animations are skipped over. The flag is flipped back after the move operation is complete.

There is one complication that results from this. The index adjustment of elements in the list happens synchronously while the leave animation is asynchronous. This results in the leaving item getting shifted to the end of the list. This is not ideal but likely can be addressed in a future refactor.

fixes: #63544

PR Close #63745
2025-09-12 15:21:24 +00:00
..
authoring refactor(core): dispatch enter and leave animations at the right times (#63450) 2025-09-10 22:24:00 +00: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 refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
animation_spec.ts fix(core): Prevent leave animations on a move operation (#63745) 2025-09-12 15:21:24 +00: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 refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -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): dispatch enter and leave animations at the right times (#63450) 2025-09-10 22:24:00 +00:00
change_detection_signals_in_zones_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
change_detection_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
change_detection_transplanted_view_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
chrome_dev_tools_performance_spec.ts fix(core): handle different DI token types in Chrome DevTools integration (#61333) 2025-05-15 10:15:32 -07:00
common_integration_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
component_spec.ts build: migrate all ts_library in packages/core/test (#61472) 2025-05-20 10:00:43 +00:00
content_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
control_flow_for_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
control_flow_if_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
control_flow_switch_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
copy_definition_feature_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
create_component_spec.ts fix(core): InputBinding marks component a dirty. (#62613) 2025-07-14 15:46:29 -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): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
defer_utils_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
destroy_ref_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
di_forward_ref_spec.ts refactor(core): include DI path into cyclic dependency error message (#50902) 2025-07-10 10:35:12 -07:00
di_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
directive_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
discover_utils_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
embedded_views_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07: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 refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
hmr_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
host_binding_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
host_directives_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
i18n_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
inherit_definition_feature_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
injector_profiler_spec.ts refactor(router): Add internal flag to control async vs rxjs recognize (#62994) 2025-08-29 08:55:13 -07:00
integration_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
internal_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
let_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
lifecycle_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
listener_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
local_compilation_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07: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 refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
pending_tasks_spec.ts fix(core): Explicit Zone CD in TestBed providers should not override TestBed error handler (#63404) 2025-09-02 09:26:44 -07:00
pipe_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
profiler_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
property_binding_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
property_interpolation_spec.ts refactor(core): replace propertyInterpolateX with property (#61639) 2025-05-26 09:21:23 +00:00
providers_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
pure_function_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
query_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
renderer_factory_spec.ts refactor(core): dispatch enter and leave animations at the right times (#63450) 2025-09-10 22:24:00 +00: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 refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
signal_debug_spec.ts fix(core): properly handle the case where getSignalGraph is called on a componentless NodeInjector (#60772) 2025-06-04 12:16:47 -04:00
standalone_injector_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
standalone_spec.ts feat(compiler): support the in keyword in Binary expression (#58432) 2025-04-22 21:44:12 +02:00
styling_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
template_ref_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
text_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
tracing_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
view_container_ref_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
view_insertion_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -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