angular/packages/core/test
Alex Rickabaugh 849dba6c65 fix(forms): implement custom control reset propagation
Introduce a highly decoupled FVC and CVA custom control reset mechanism, and implement the framework-wide automatic `transformedValue` and native controls clearing bridge for both new Signal Forms and legacy forms (Template-driven and Reactive).

1. Custom Control Reset Propagation (Bug #2):
- Establish agnostic custom control resetting via `FormFieldBindingOptions.reset` in `FormField`.
- Ensure that `FieldNode.reset()` unconditionally triggers `writeValue` updates on CVA custom controls.
- Protect against duplicate writes during subsequent change detection updates in `control_cva.ts` by verifying and tracking previous written values in the local bindings cache.

2. Unified Framework-wide FormControl Integration:
- Introduce a monorepo-wide private InjectionToken `ɵFORM_CONTROL_INTEGRATION` and `ɵFormControlIntegration` interface to act as the single, decoupled bridge for hooking up FVC parse errors and receiving control resets across both Signal and legacy forms architectures.
- Simplify Signal Forms: make `FormField` implements `ɵFormControlIntegration` directly, removing the intermediate context object and reducing DI boilerplate down to a clean `useExisting: FormField` provider. Triggers the `onReset` callback directly inside `FormField.reset()`.
- Upgrade Legacy Forms: `NG_CONTROL_INTEGRATION_PROVIDER` provides the renamed token. `NgControl` handles the event subscription internally (`set onReset(callback)`) to recursively listen to `control.events` (`FormResetEvent`) lazily only when assigned, resolving all `FormControl` swapping timing and lifecycle cleanup races automatically.

3. Automatic `transformedValue` and Native Controls Utility Clearing:
- Make `Parser.reset()` method required in the interface for a cleaner and non-defensive execution.
- Wire `transformedValue` into the new integration token `ɵFORM_CONTROL_INTEGRATION` to clear validation parsing states on resets.
- Lazily resets the UI-facing `rawValue` linked signal utilizing the original native `linkedSignal.set` callback (`originalSet`), correctly bypassing the UI-to-model parser loopback and preventing redundant model writes during `reset()`.
- Wire up Native Controls (`control_native.ts\Device`): Hook `parent.onReset` inside native element creation to automatically trigger the native `parser.reset()` and force DOM writes (`setNativeControlValue`) back down to the DOM input value during resets, ensuring native elements with pending parsing validation errors are successfully cleared and synced on form resets.

TAG=agy
CONV=8b4cee1e-2117-42a4-b242-c8ec7bf01752
2026-05-06 10:45:40 -07:00
..
acceptance fix(core): enforce return type for service factory 2026-05-05 09:30:29 -07:00
animation refactor(core): Update determineLongestAnimation to account for playback rate 2026-03-12 17:36:50 -06:00
animation_utils refactor(core): dispatch enter and leave animations at the right times (#63450) 2025-09-10 22:24:00 +00:00
authoring fix(core): allow explicit read generic with signal input transforms 2026-05-01 15:53:56 -07:00
bundling fix(forms): implement custom control reset propagation 2026-05-06 10:45:40 -07:00
change_detection build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00
compiler refactor(compiler): remove zone-based testing utilities 2026-02-09 07:55:12 -08:00
debug feat(core): implement Angular DI graph in-page AI tool 2026-04-14 18:35:51 +03:00
di refactor(core): add support for default exports to injectAsync 2026-04-30 15:53:07 -07:00
dom build: migrate all ts_library in packages/core/test (#61472) 2025-05-20 10:00:43 +00:00
hydration fix(core): catch hydration marker with implicit body tag (#60429) 2025-03-19 15:51:36 +01:00
i18n refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
legacy_animation feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
linker feat(compiler): Angular expressions with optional chaining returns undefined 2026-04-28 15:26:53 -07:00
metadata refactor(core): improve resource loading with async/await 2025-11-11 12:50:16 -08:00
reflection refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
render3 feat(core): introduce @Service decorator 2026-04-22 11:01:01 -07:00
resource feat(core): add ability to cache resources for SSR 2026-05-06 09:57:49 -07:00
sanitization fix(core): prevent binding unsafe attributes on SVG animation elements (#67797) 2026-04-01 11:43:58 +02:00
signals fix(core): run linked signal equality check without reactive consumer 2026-03-17 13:59:38 -06:00
strict_types build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
testability feat(core): Update Testability to use PendingTasks for stability indicator 2026-04-20 13:08:43 -07:00
util build: update Jasmine to 6.0.0 2026-02-09 12:15:57 -08:00
zone ci: reformat files 2025-12-16 14:44:19 -08:00
application_config_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
application_init_spec.ts test(core): refactors test to use timeout utility 2026-04-01 20:46:00 +02:00
application_module_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
application_ref_integration_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
application_ref_spec.ts feat(core): bootstrap via ApplicationRef with config 2026-04-07 12:48:53 -07:00
BUILD.bazel ci: remove remainings of saucelabs tests 2026-04-22 14:41:03 -07:00
change_detection_scheduler_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
component_fixture_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
defer_fixture_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
dev_mode_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
directive_lifecycle_integration_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
error_handler_spec.ts test(core): refactors test to use timeout utility 2026-04-01 20:46:00 +02:00
event_emitter_spec.ts refactor(core): Update tests for zoneless by default (#63668) 2025-09-09 14:41:56 -07:00
fake_async_spec.ts refactor(core): convert scripts within packages/core/test to relative imports (#60227) 2025-03-25 10:58:00 -07:00
forward_ref_integration_spec.ts ci: reformat files 2025-12-16 14:44:19 -08:00
runtime_error_spec.ts refactor(core): update error message links to versioned docs (#66374) 2026-01-09 22:33:51 +00:00
test_bed_effect_spec.ts feat(core): Set default Component changeDetection strategy to OnPush 2026-03-24 16:25:02 -07:00
test_bed_spec.ts refactor(core): Don't throw when there are not async metadata 2026-04-27 17:04:09 -07:00
transfer_state_spec.ts fix(core): escape forward slashes in transfer state to prevent crawler indexing 2026-04-13 13:54:55 +03:00