angular / angular/components

bug(mat-form-field): Async validators can't be tested with MatFormFieldHarness

オープン
#29,559 コメント 0 件 リアクション 2 件 担当者 0 名 GitHub で見る
area: material/form-field P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### 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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、リンク先の StackBlitz の再現を実行し、非同期バリデーターに関する MatFormFieldHarness の動作を読みます。テストフローを、手動で呼び出される MatInput#ngDoCheck または MatInput#updateErrorState の呼び出しと比較します。tick(1) だけでテストが成功し、非同期バリデーションエラーが表示されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend, testing
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。