bug(MatInputTestHarness): setValue does not trigger "change" event
- Langage dominant
- TypeScript
- Étoiles
- 25k
- Forks
- 6.8k
- Merge moyen
- 1 j 8 h
- PR mergées (30 j)
- 91
Description
### 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
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le comportement de MatInputTestHarness décrit dans l’issue et exécutez la reproduction StackBlitz liée, basée sur l’exemple d’input Material modifié. Vérifiez les spies d’événements en échec autour de setValue(), y compris la tentative de focus et de blur. C’est terminé lorsque le change handler attendu s’exécute et que les deux tests de reproduction passent.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- frontend, testing
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100