bug(mat-form-field): Async validators can't be tested with MatFormFieldHarness
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
### 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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện StackBlitz được liên kết và đọc hành vi của MatFormFieldHarness đối với các validator bất đồng bộ. So sánh luồng kiểm thử với các lệnh gọi MatInput#ngDoCheck hoặc MatInput#updateErrorState được gọi thủ công. Được xem là hoàn tất khi kiểm thử thành công chỉ với tick(1) và lỗi xác thực bất đồng bộ xuất hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend, testing
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100