angular / angular/components

CDK/testing: typeInElement ignores event.defaultPrevented

オープン
#27,475 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: cdk/testing G P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

src/cdk/testing/testbed/fake-events/type-in-element.ts のリンク先の行から始め、続いて提供されている StackBlitz の再現を実行して、harness の動作とブラウザーの動作を比較します。defaultPrevented が設定された keydown イベントによって input 要素が入力されなくなれば、issue は完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
testing
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。