2018-11-21 03:43:07 +00:00
|
|
|
/**
|
|
|
|
* Copyright 2018 Google Inc. All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const utils = require('./utils');
|
2019-02-03 01:49:12 +00:00
|
|
|
const os = require('os');
|
2020-04-09 05:56:25 +00:00
|
|
|
const expect = require('expect');
|
2020-05-07 10:54:55 +00:00
|
|
|
const {
|
|
|
|
getTestState,
|
|
|
|
setupTestBrowserHooks,
|
|
|
|
setupTestPageAndContextHooks,
|
|
|
|
} = require('./mocha-utils');
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
describe('Keyboard', function () {
|
2020-04-09 05:56:25 +00:00
|
|
|
setupTestBrowserHooks();
|
|
|
|
setupTestPageAndContextHooks();
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should type into a textarea', async () => {
|
|
|
|
const { page } = getTestState();
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.evaluate(() => {
|
|
|
|
const textarea = document.createElement('textarea');
|
|
|
|
document.body.appendChild(textarea);
|
|
|
|
textarea.focus();
|
2018-11-21 03:43:07 +00:00
|
|
|
});
|
2020-04-09 05:56:25 +00:00
|
|
|
const text = 'Hello world. I am the text that was typed!';
|
|
|
|
await page.keyboard.type(text);
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe(text);
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox('should press the metaKey', async () => {
|
|
|
|
const { page, isFirefox } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.evaluate(() => {
|
2020-05-07 10:54:55 +00:00
|
|
|
window.keyPromise = new Promise((resolve) =>
|
|
|
|
document.addEventListener('keydown', (event) => resolve(event.key))
|
|
|
|
);
|
2018-11-21 03:43:07 +00:00
|
|
|
});
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.keyboard.press('Meta');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate('keyPromise')).toBe(
|
|
|
|
isFirefox && os.platform() !== 'darwin' ? 'OS' : 'Meta'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should move with the arrow keys', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
await page.type('textarea', 'Hello World!');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('Hello World!');
|
|
|
|
for (let i = 0; i < 'World!'.length; i++) page.keyboard.press('ArrowLeft');
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.keyboard.type('inserted ');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('Hello inserted World!');
|
2020-04-09 05:56:25 +00:00
|
|
|
page.keyboard.down('Shift');
|
|
|
|
for (let i = 0; i < 'inserted '.length; i++)
|
|
|
|
page.keyboard.press('ArrowLeft');
|
|
|
|
page.keyboard.up('Shift');
|
|
|
|
await page.keyboard.press('Backspace');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('Hello World!');
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should send a character with ElementHandle.press', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
const textarea = await page.$('textarea');
|
|
|
|
await textarea.press('a');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('a');
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
await page.evaluate(() =>
|
|
|
|
window.addEventListener('keydown', (e) => e.preventDefault(), true)
|
|
|
|
);
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await textarea.press('b');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('a');
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox(
|
|
|
|
'ElementHandle.press should support |text| option',
|
|
|
|
async () => {
|
|
|
|
const { page, server } = getTestState();
|
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
const textarea = await page.$('textarea');
|
|
|
|
await textarea.press('a', { text: 'ё' });
|
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('ё');
|
|
|
|
}
|
|
|
|
);
|
|
|
|
itFailsFirefox('should send a character with sendCharacter', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2018-11-21 03:43:07 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
await page.focus('textarea');
|
|
|
|
await page.keyboard.sendCharacter('嗨');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('嗨');
|
|
|
|
await page.evaluate(() =>
|
|
|
|
window.addEventListener('keydown', (e) => e.preventDefault(), true)
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.keyboard.sendCharacter('a');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(
|
|
|
|
await page.evaluate(() => document.querySelector('textarea').value)
|
|
|
|
).toBe('嗨a');
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-06-12 13:55:51 +00:00
|
|
|
it('should report shiftKey', async () => {
|
2020-05-07 10:54:55 +00:00
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/keyboard.html');
|
|
|
|
const keyboard = page.keyboard;
|
2020-05-07 10:54:55 +00:00
|
|
|
const codeForKey = { Shift: 16, Alt: 18, Control: 17 };
|
2020-04-09 05:56:25 +00:00
|
|
|
for (const modifierKey in codeForKey) {
|
|
|
|
await keyboard.down(modifierKey);
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keydown: ' +
|
|
|
|
modifierKey +
|
|
|
|
' ' +
|
|
|
|
modifierKey +
|
|
|
|
'Left ' +
|
|
|
|
codeForKey[modifierKey] +
|
|
|
|
' [' +
|
|
|
|
modifierKey +
|
|
|
|
']'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.down('!');
|
|
|
|
// Shift+! will generate a keypress
|
|
|
|
if (modifierKey === 'Shift')
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keydown: ! Digit1 49 [' +
|
|
|
|
modifierKey +
|
|
|
|
']\nKeypress: ! Digit1 33 33 [' +
|
|
|
|
modifierKey +
|
|
|
|
']'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
else
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keydown: ! Digit1 49 [' + modifierKey + ']'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await keyboard.up('!');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keyup: ! Digit1 49 [' + modifierKey + ']'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.up(modifierKey);
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keyup: ' +
|
|
|
|
modifierKey +
|
|
|
|
' ' +
|
|
|
|
modifierKey +
|
|
|
|
'Left ' +
|
|
|
|
codeForKey[modifierKey] +
|
|
|
|
' []'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
}
|
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should report multiple modifiers', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/keyboard.html');
|
|
|
|
const keyboard = page.keyboard;
|
|
|
|
await keyboard.down('Control');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keydown: Control ControlLeft 17 [Control]'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.down('Alt');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keydown: Alt AltLeft 18 [Alt Control]'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.down(';');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keydown: ; Semicolon 186 [Alt Control]'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.up(';');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keyup: ; Semicolon 186 [Alt Control]'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.up('Control');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keyup: Control ControlLeft 17 [Alt]'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.up('Alt');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
|
|
|
'Keyup: Alt AltLeft 18 []'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should send proper codes while typing', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/keyboard.html');
|
|
|
|
await page.keyboard.type('!');
|
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Keydown: ! Digit1 49 []',
|
|
|
|
'Keypress: ! Digit1 33 33 []',
|
|
|
|
'Keyup: ! Digit1 49 []',
|
|
|
|
].join('\n')
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.keyboard.type('^');
|
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Keydown: ^ Digit6 54 []',
|
|
|
|
'Keypress: ^ Digit6 94 94 []',
|
|
|
|
'Keyup: ^ Digit6 54 []',
|
|
|
|
].join('\n')
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should send proper codes while typing with shift', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/keyboard.html');
|
|
|
|
const keyboard = page.keyboard;
|
|
|
|
await keyboard.down('Shift');
|
|
|
|
await page.keyboard.type('~');
|
|
|
|
expect(await page.evaluate(() => getResult())).toBe(
|
2020-05-07 10:54:55 +00:00
|
|
|
[
|
|
|
|
'Keydown: Shift ShiftLeft 16 [Shift]',
|
|
|
|
'Keydown: ~ Backquote 192 [Shift]', // 192 is ` keyCode
|
|
|
|
'Keypress: ~ Backquote 126 126 [Shift]', // 126 is ~ charCode
|
|
|
|
'Keyup: ~ Backquote 192 [Shift]',
|
|
|
|
].join('\n')
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await keyboard.up('Shift');
|
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should not type canceled events', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
await page.focus('textarea');
|
|
|
|
await page.evaluate(() => {
|
2020-05-07 10:54:55 +00:00
|
|
|
window.addEventListener(
|
|
|
|
'keydown',
|
|
|
|
(event) => {
|
|
|
|
event.stopPropagation();
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
if (event.key === 'l') event.preventDefault();
|
|
|
|
if (event.key === 'o') event.preventDefault();
|
|
|
|
},
|
|
|
|
false
|
|
|
|
);
|
2018-11-21 03:43:07 +00:00
|
|
|
});
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.keyboard.type('Hello World!');
|
|
|
|
expect(await page.evaluate(() => textarea.value)).toBe('He Wrd!');
|
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox('should specify repeat property', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
await page.focus('textarea');
|
2020-05-07 10:54:55 +00:00
|
|
|
await page.evaluate(() =>
|
|
|
|
document
|
|
|
|
.querySelector('textarea')
|
|
|
|
.addEventListener('keydown', (e) => (window.lastEvent = e), true)
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.keyboard.down('a');
|
|
|
|
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(false);
|
|
|
|
await page.keyboard.press('a');
|
|
|
|
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(true);
|
|
|
|
|
|
|
|
await page.keyboard.down('b');
|
|
|
|
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(false);
|
|
|
|
await page.keyboard.down('b');
|
|
|
|
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(true);
|
|
|
|
|
|
|
|
await page.keyboard.up('a');
|
|
|
|
await page.keyboard.down('a');
|
|
|
|
expect(await page.evaluate(() => window.lastEvent.repeat)).toBe(false);
|
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox('should type all kinds of characters', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
await page.focus('textarea');
|
|
|
|
const text = 'This text goes onto two lines.\nThis character is 嗨.';
|
|
|
|
await page.keyboard.type(text);
|
|
|
|
expect(await page.evaluate('result')).toBe(text);
|
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox('should specify location', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
await page.evaluate(() => {
|
2020-05-07 10:54:55 +00:00
|
|
|
window.addEventListener(
|
|
|
|
'keydown',
|
|
|
|
(event) => (window.keyLocation = event.location),
|
|
|
|
true
|
|
|
|
);
|
2018-11-21 03:43:07 +00:00
|
|
|
});
|
2020-04-09 05:56:25 +00:00
|
|
|
const textarea = await page.$('textarea');
|
2019-02-27 23:13:17 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await textarea.press('Digit5');
|
|
|
|
expect(await page.evaluate('keyLocation')).toBe(0);
|
2019-02-27 23:13:17 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await textarea.press('ControlLeft');
|
|
|
|
expect(await page.evaluate('keyLocation')).toBe(1);
|
2019-02-27 23:13:17 +00:00
|
|
|
|
2020-04-09 05:56:25 +00:00
|
|
|
await textarea.press('ControlRight');
|
|
|
|
expect(await page.evaluate('keyLocation')).toBe(2);
|
|
|
|
|
|
|
|
await textarea.press('NumpadSubtract');
|
|
|
|
expect(await page.evaluate('keyLocation')).toBe(3);
|
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
it('should throw on unknown keys', async () => {
|
|
|
|
const { page } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
let error = await page.keyboard
|
|
|
|
.press('NotARealKey')
|
|
|
|
.catch((error_) => error_);
|
2020-04-09 05:56:25 +00:00
|
|
|
expect(error.message).toBe('Unknown key: "NotARealKey"');
|
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
error = await page.keyboard.press('ё').catch((error_) => error_);
|
2020-04-09 05:56:25 +00:00
|
|
|
expect(error && error.message).toBe('Unknown key: "ё"');
|
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
error = await page.keyboard.press('😊').catch((error_) => error_);
|
2020-04-09 05:56:25 +00:00
|
|
|
expect(error && error.message).toBe('Unknown key: "😊"');
|
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox('should type emoji', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.PREFIX + '/input/textarea.html');
|
|
|
|
await page.type('textarea', '👹 Tokyo street Japan 🇯🇵');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await page.$eval('textarea', (textarea) => textarea.value)).toBe(
|
|
|
|
'👹 Tokyo street Japan 🇯🇵'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox('should type emoji into an iframe', async () => {
|
|
|
|
const { page, server } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.goto(server.EMPTY_PAGE);
|
2020-05-07 10:54:55 +00:00
|
|
|
await utils.attachFrame(
|
|
|
|
page,
|
|
|
|
'emoji-test',
|
|
|
|
server.PREFIX + '/input/textarea.html'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
const frame = page.frames()[1];
|
|
|
|
const textarea = await frame.$('textarea');
|
|
|
|
await textarea.type('👹 Tokyo street Japan 🇯🇵');
|
2020-05-07 10:54:55 +00:00
|
|
|
expect(await frame.$eval('textarea', (textarea) => textarea.value)).toBe(
|
|
|
|
'👹 Tokyo street Japan 🇯🇵'
|
|
|
|
);
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|
2020-05-07 10:54:55 +00:00
|
|
|
itFailsFirefox('should press the meta key', async () => {
|
|
|
|
const { page, isFirefox } = getTestState();
|
2020-04-09 05:56:25 +00:00
|
|
|
|
|
|
|
await page.evaluate(() => {
|
|
|
|
window.result = null;
|
2020-05-07 10:54:55 +00:00
|
|
|
document.addEventListener('keydown', (event) => {
|
2020-04-09 05:56:25 +00:00
|
|
|
window.result = [event.key, event.code, event.metaKey];
|
|
|
|
});
|
2019-02-27 23:13:17 +00:00
|
|
|
});
|
2020-04-09 05:56:25 +00:00
|
|
|
await page.keyboard.press('Meta');
|
|
|
|
const [key, code, metaKey] = await page.evaluate('result');
|
2020-05-07 10:54:55 +00:00
|
|
|
if (isFirefox && os.platform() !== 'darwin') expect(key).toBe('OS');
|
|
|
|
else expect(key).toBe('Meta');
|
2020-04-09 05:56:25 +00:00
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
if (isFirefox) expect(code).toBe('OSLeft');
|
|
|
|
else expect(code).toBe('MetaLeft');
|
2020-04-09 05:56:25 +00:00
|
|
|
|
2020-05-07 10:54:55 +00:00
|
|
|
if (isFirefox && os.platform() !== 'darwin') expect(metaKey).toBe(false);
|
|
|
|
else expect(metaKey).toBe(true);
|
2018-11-21 03:43:07 +00:00
|
|
|
});
|
2020-04-09 05:56:25 +00:00
|
|
|
});
|