angular / angular/components

CDK/testing: typeInElement ignores event.defaultPrevented

Abierto
#27,475 1 comentario 0 reacciones 0 asignados Ver en GitHub
area: cdk/testing G 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

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en src/cdk/testing/testbed/fake-events/type-in-element.ts en la línea enlazada y, después, ejecuta la reproducción proporcionada en StackBlitz para comparar el comportamiento del harness con el comportamiento del navegador. El issue estará resuelto cuando un evento keydown con defaultPrevented establecido ya no complete el elemento de entrada.

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

Evaluación

Stack tecnológico
angular, typescript
Área
testing
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.