fix(input): send keypress event for enter key in chromium (#3796)
This commit is contained in:
parent
b28ed214ca
commit
1791be6d16
|
|
@ -53,6 +53,8 @@ export class RawKeyboardImpl implements input.RawKeyboard {
|
||||||
let commands = macEditingCommands[shortcut] || [];
|
let commands = macEditingCommands[shortcut] || [];
|
||||||
if (isString(commands))
|
if (isString(commands))
|
||||||
commands = [commands];
|
commands = [commands];
|
||||||
|
// Commands that insert text are not supported
|
||||||
|
commands = commands.filter(x => !x.startsWith('insert'));
|
||||||
// remove the trailing : to match the Chromium command names.
|
// remove the trailing : to match the Chromium command names.
|
||||||
return commands.map(c => c.substring(0, c.length - 1));
|
return commands.map(c => c.substring(0, c.length - 1));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,9 +237,7 @@ it('page.press should work', async ({page, server}) => {
|
||||||
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a');
|
expect(await page.evaluate(() => document.querySelector('textarea').value)).toBe('a');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('page.press should work for Enter', test => {
|
it('page.press should work for Enter', async ({page, server}) => {
|
||||||
test.fail(options.CHROMIUM && MAC, 'page.press() does not emit keypress event on Enter');
|
|
||||||
}, async ({page, server}) => {
|
|
||||||
await page.setContent(`<input onkeypress="console.log('press')"></input>`);
|
await page.setContent(`<input onkeypress="console.log('press')"></input>`);
|
||||||
const messages = [];
|
const messages = [];
|
||||||
page.on('console', message => messages.push(message));
|
page.on('console', message => messages.push(message));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue