angular / angular/components

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

Đang mở
#30,160 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: cdk/testing P3
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

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu với hành vi của MatInputTestHarness được mô tả trong issue và chạy bản tái hiện StackBlitz được liên kết, dựa trên ví dụ input Material đã sửa đổi. Xác minh các event spy đang bị lỗi xung quanh setValue(), bao gồm cả lần thử focus và blur. Hoàn tất khi change handler dự kiến được chạy và cả hai bài kiểm tra tái hiện đều vượt qua.

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
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.