mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
Strongly type key in pressKey
R=jacktfranklin@chromium.org Bug: none Change-Id: Ib9eb75bdb76124e1d4f6d54e5b5edcfdea6a4504 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3135426 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
This commit is contained in:
committed by
Devtools-frontend LUCI CQ
parent
f926302965
commit
d79e3c545b
@@ -128,7 +128,8 @@ export const typeText = async (text: string) => {
|
||||
await frontend.keyboard.type(text);
|
||||
};
|
||||
|
||||
export const pressKey = async (key: string, modifiers?: {control?: boolean, alt?: boolean, shift?: boolean}) => {
|
||||
export const pressKey =
|
||||
async (key: puppeteer.KeyInput, modifiers?: {control?: boolean, alt?: boolean, shift?: boolean}) => {
|
||||
const {frontend} = getBrowserAndPages();
|
||||
if (modifiers) {
|
||||
if (modifiers.control) {
|
||||
@@ -146,7 +147,7 @@ export const pressKey = async (key: string, modifiers?: {control?: boolean, alt?
|
||||
await frontend.keyboard.down('Shift');
|
||||
}
|
||||
}
|
||||
await frontend.keyboard.press(key as puppeteer.KeyInput);
|
||||
await frontend.keyboard.press(key);
|
||||
if (modifiers) {
|
||||
if (modifiers.shift) {
|
||||
await frontend.keyboard.up('Shift');
|
||||
|
||||
Reference in New Issue
Block a user