bug(mat-form-field): Async validators can't be tested with MatFormFieldHarness
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
When I try to test an async validator in a mat-form-file, the error never shows up and my test fails.
### Reproduction
[StackBlitz link](https://stackblitz.com/edit/2ptgpt)
Steps to reproduce:
1. Run the test.
### Expected Behavior
It should succeed by calling `tick(1)`
### Actual Behavior
I have to call `MatInput#ngDoCheck` or `MatInput#updateErrorState` manually, and it really feels weird.
### Environment
Angular CLI: 18.0.2
Node: 18.20.3
Package Manager: yarn 1.22.19
OS: linux x64
Angular: 18.0.1
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.1800.2
@angular-devkit/build-angular 18.0.2
@angular-devkit/core 18.0.2
@angular-devkit/schematics 18.0.2
@angular/cdk 18.1.4
@angular/cli 18.0.2
@angular/material 18.1.4
@angular/material-experimental 18.1.4
@angular/material-moment-adapter 18.1.4
@schematics/angular 18.0.2
rxjs 7.4.0
typescript 5.4.5
zone.js 0.14.6
Contributor guide
Research direction
Start by running the linked StackBlitz reproduction and reading the MatFormFieldHarness behavior around async validators. Compare the test flow with the manually invoked MatInput#ngDoCheck or MatInput#updateErrorState calls. Done means the test succeeds with tick(1) alone and the async validation error appears.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100