angular / angular/components

bug(MatInputTestHarness): setValue does not trigger "change" event

オープン
#30,160 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: cdk/testing 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

According to the documentation, the MatInput component emits a "change" event when the value changes. However, the test harness does not emit this event after "setValue()". See the stackblitz.

I have tried using focus() to focus the component before setting the value, then blur() to remove focus, which is what triggers "change" in the application, and there is still no "change" event.

### Reproduction

StackBlitz link: https://stackblitz.com/edit/phfedq5f?file=src%2Fexample%2Finput-harness-example.html
Steps to reproduce:
1. modified example test from https://material.angular.io/components/input/examples should run automatically
2. two tests fail because the event spy is not called

### Expected Behavior

You should be able to trigger the expected event with the test harness.

### Actual Behavior

Expected code associated with (change) to run.

### Environment

- Angular: 19
- CDK/Material: 19
- Browser(s): chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows, macOs

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

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

調査の方向性

issue に記載されている MatInputTestHarness の動作から始め、変更された Material input の例に基づく、リンク先の StackBlitz の再現を実行します。focus と blur の試行を含め、setValue() 周辺で失敗しているイベントスパイを確認します。期待される change handler が実行され、再現テストの両方がパスすれば完了です。

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

評価

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

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

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