CDK/testing: typeInElement ignores event.defaultPrevented
- 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
The `typeInElement` [1] still sets the input value even if the `keydown` event has default prevented. This is different from the actual behavior [2]
[1]: https://github.com/angular/components/blob/ffffc82084b3528a4b5a95a91ec77359449acc97/src/cdk/testing/testbed/fake-events/type-in-element.ts#L114
[2]: https://stackblitz.com/edit/web-platform-gwblaq?file=script.js
### Reproduction
StackBlitz link: https://stackblitz.com/edit/harness-issue-4xv58x?file=src%2Fapp%2Fharness-example.html
### Expected Behavior
`event.preventDefault()` should stop the browser from populating the input element.
### Actual Behavior
Input element is still populated with values
### Environment
- Angular: 10.2.3
- CDK/Material: 11.0.0
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): macOS
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez dans src/cdk/testing/testbed/fake-events/type-in-element.ts à la ligne indiquée par le lien, puis exécutez la reproduction fournie dans StackBlitz afin de comparer le comportement du harness avec celui du navigateur. L’issue est terminée lorsqu’un événement keydown avec defaultPrevented défini ne renseigne plus l’élément input.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- angular, typescript
- Domaine
- testing
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 42/100