angular/packages/forms/test
Andrew Scott 658cf8c384 fix(core): ComponentFixture stability should match ApplicationRef (#54949)
This change aligns the stability of `ComponentFixture` with that of
`ApplicationRef`, preventing confusing differences between the two as
more APIs start using the `PendingTasks` that may not be tracked by
`NgZone`.

BREAKING CHANGE: `ComponentFixture.whenStable` now matches the
`ApplicationRef.isStable` observable. Prior to this change, stability
of the fixture did not include everything that was considered in
`ApplicationRef`. `whenStable` of the fixture will now include unfinished
router navigations and unfinished `HttpClient` requests. This will cause
tests that `await` the `whenStable` promise to time out when there are
incomplete requests. To fix this, remove the `whenStable`,
instead wait for another condition, or ensure `HttpTestingController`
mocks responses for all requests. Try adding `HttpTestingController.verify()`
before your `await fixture.whenStable` to identify the open requests.
Also, make sure your tests wait for the stability promise. We found many
examples of tests that did not, meaning the expectations did not execute
within the test body.

In addition, `ComponentFixture.isStable` would synchronously switch to
true in some scenarios but will now always be asynchronous.

PR Close #54949
2024-03-27 11:01:28 -07:00
..
BUILD.bazel refactor: update forms package tests to work with ES2020 ESM (#48521) 2022-12-19 19:50:43 +00:00
directives_spec.ts test(core): clean up unnecessary nesting in old tests (#52239) 2023-10-19 09:26:15 -07:00
form_array_spec.ts refactor(forms): cleanup type any in forms tests (#48624) 2023-01-05 14:52:03 -08:00
form_builder_spec.ts refactor(forms): cleanup type any in forms tests (#48624) 2023-01-05 14:52:03 -08:00
form_control_spec.ts Revert "feat(forms): Improve typings form (async)Validators" (#49706) 2023-04-04 11:26:04 -07:00
form_group_spec.ts refactor(forms): Log a warning when FormGroup keys include a dot. (#50642) 2023-10-18 12:11:25 -07:00
reactive_integration_spec.ts test(core): clean up unnecessary nesting in old tests (#52239) 2023-10-19 09:26:15 -07:00
template_integration_spec.ts fix(core): ComponentFixture stability should match ApplicationRef (#54949) 2024-03-27 11:01:28 -07:00
typed_integration_spec.ts build: align with internal tsconfig options (#51728) 2023-09-12 11:39:42 -07:00
util.ts refactor: use queueMicrotask to schedule micro tasks instead of various helpers (#50485) 2023-06-15 16:38:21 +02:00
validators_spec.ts refactor(forms): remove deprecated uses from the unit tests (#48894) 2023-02-02 09:28:39 -08:00
value_accessor_integration_spec.ts refactor: fix a number of typos throughout the codebase (#55018) 2024-03-27 10:54:31 -07:00