chore(bidi): propertly dispatch ControlRight key event (#34246)
This commit is contained in:
parent
809225503c
commit
6fb6282a9d
|
|
@ -33,7 +33,7 @@ export class RawKeyboardImpl implements input.RawKeyboard {
|
||||||
|
|
||||||
async keydown(modifiers: Set<types.KeyboardModifier>, code: string, keyCode: number, keyCodeWithoutLocation: number, key: string, location: number, autoRepeat: boolean, text: string | undefined): Promise<void> {
|
async keydown(modifiers: Set<types.KeyboardModifier>, code: string, keyCode: number, keyCodeWithoutLocation: number, key: string, location: number, autoRepeat: boolean, text: string | undefined): Promise<void> {
|
||||||
const actions: bidi.Input.KeySourceAction[] = [];
|
const actions: bidi.Input.KeySourceAction[] = [];
|
||||||
actions.push({ type: 'keyDown', value: getBidiKeyValue(key) });
|
actions.push({ type: 'keyDown', value: getBidiKeyValue(code) });
|
||||||
// TODO: add modifiers?
|
// TODO: add modifiers?
|
||||||
await this._performActions(actions);
|
await this._performActions(actions);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -256,16 +256,24 @@ it('should specify location', async ({ page, server }) => {
|
||||||
const textarea = await page.$('textarea');
|
const textarea = await page.$('textarea');
|
||||||
|
|
||||||
await textarea.press('Digit5');
|
await textarea.press('Digit5');
|
||||||
expect(await lastEvent.evaluate(e => e.location)).toBe(0);
|
expect.soft(await lastEvent.evaluate(e => e.location)).toBe(0);
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.key)).toBe('5');
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.code)).toBe('Digit5');
|
||||||
|
|
||||||
await textarea.press('ControlLeft');
|
await textarea.press('ControlLeft');
|
||||||
expect(await lastEvent.evaluate(e => e.location)).toBe(1);
|
expect.soft(await lastEvent.evaluate(e => e.location)).toBe(1);
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.key)).toBe('Control');
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.code)).toBe('ControlLeft');
|
||||||
|
|
||||||
await textarea.press('ControlRight');
|
await textarea.press('ControlRight');
|
||||||
expect(await lastEvent.evaluate(e => e.location)).toBe(2);
|
expect.soft(await lastEvent.evaluate(e => e.location)).toBe(2);
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.key)).toBe('Control');
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.code)).toBe('ControlRight');
|
||||||
|
|
||||||
await textarea.press('NumpadSubtract');
|
await textarea.press('NumpadSubtract');
|
||||||
expect(await lastEvent.evaluate(e => e.location)).toBe(3);
|
expect.soft(await lastEvent.evaluate(e => e.location)).toBe(3);
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.key)).toBe('-');
|
||||||
|
expect.soft(await lastEvent.evaluate(e => e.code)).toBe('NumpadSubtract');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should press Enter', async ({ page, server }) => {
|
it('should press Enter', async ({ page, server }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue