angular / angular/components

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

Abierto
#30,160 1 comentario 0 reacciones 0 asignados Ver en GitHub
area: cdk/testing P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el comportamiento de MatInputTestHarness descrito en el issue y ejecuta la reproducción enlazada de StackBlitz, basada en el ejemplo de input de Material modificado. Verifica los spies de eventos que fallan alrededor de setValue(), incluidos los intentos de focus y blur. Se considera completado cuando se ejecuta el change handler esperado y ambas pruebas de reproducción pasan.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend, testing
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.