angular / angular/components

CDK/testing: typeInElement ignores event.defaultPrevented

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

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

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

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

Hướng nghiên cứu

Bắt đầu tại src/cdk/testing/testbed/fake-events/type-in-element.ts ở dòng được liên kết, sau đó chạy bản tái hiện được cung cấp trên StackBlitz để so sánh hành vi của harness với hành vi của trình duyệt. Issue hoàn tất khi một sự kiện keydown có defaultPrevented được đặt không còn điền vào phần tử input.

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
testing
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
42/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.