mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-02 10:34:27 +03:00
parent
736c0efd43
commit
8d3a931377
@ -21,19 +21,19 @@
|
||||
},
|
||||
{
|
||||
"name": "firefox",
|
||||
"revision": "1430",
|
||||
"revision": "1433",
|
||||
"installByDefault": true,
|
||||
"browserVersion": "120.0.1"
|
||||
},
|
||||
{
|
||||
"name": "firefox-asan",
|
||||
"revision": "1430",
|
||||
"revision": "1433",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "120.0.1"
|
||||
},
|
||||
{
|
||||
"name": "firefox-beta",
|
||||
"revision": "1430",
|
||||
"revision": "1433",
|
||||
"installByDefault": false,
|
||||
"browserVersion": "121.0b8"
|
||||
},
|
||||
|
@ -62,10 +62,6 @@ 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> {
|
||||
if (code === 'MetaLeft')
|
||||
code = 'OSLeft';
|
||||
if (code === 'MetaRight')
|
||||
code = 'OSRight';
|
||||
// Firefox will figure out Enter by itself
|
||||
if (text === '\r')
|
||||
text = '';
|
||||
@ -81,10 +77,6 @@ export class RawKeyboardImpl implements input.RawKeyboard {
|
||||
}
|
||||
|
||||
async keyup(modifiers: Set<types.KeyboardModifier>, code: string, keyCode: number, keyCodeWithoutLocation: number, key: string, location: number): Promise<void> {
|
||||
if (code === 'MetaLeft')
|
||||
code = 'OSLeft';
|
||||
if (code === 'MetaRight')
|
||||
code = 'OSRight';
|
||||
await this._client.send('Page.dispatchKeyEvent', {
|
||||
type: 'keyup',
|
||||
key,
|
||||
|
@ -326,6 +326,16 @@ it('should handle selectAll', async ({ page, server, isMac }) => {
|
||||
expect(await page.$eval('textarea', textarea => textarea.value)).toBe('');
|
||||
});
|
||||
|
||||
it('pressing Meta should not result in any text insertion on any platform', async ({ page, server, isMac }) => {
|
||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/28495' });
|
||||
await page.setContent('<input type="text" value="hello world">');
|
||||
const input = page.locator('input');
|
||||
await expect(input).toHaveValue('hello world');
|
||||
await input.focus();
|
||||
await page.keyboard.press('Meta');
|
||||
await expect(input).toHaveValue('hello world');
|
||||
});
|
||||
|
||||
it('should be able to prevent selectAll', async ({ page, server, isMac }) => {
|
||||
await page.goto(server.PREFIX + '/input/textarea.html');
|
||||
const textarea = await page.$('textarea');
|
||||
@ -358,25 +368,13 @@ it('should support MacOS shortcuts', async ({ page, server, platform, browserNam
|
||||
expect(await page.$eval('textarea', textarea => textarea.value)).toBe('some ');
|
||||
});
|
||||
|
||||
it('should press the meta key', async ({ page, browserName, isMac, browserMajorVersion }) => {
|
||||
it('should press the meta key', async ({ page }) => {
|
||||
const lastEvent = await captureLastKeydown(page);
|
||||
await page.keyboard.press('Meta');
|
||||
const { key, code, metaKey } = await lastEvent.jsonValue();
|
||||
if (browserName === 'firefox' && !isMac)
|
||||
expect(key).toBe('OS');
|
||||
else
|
||||
expect(key).toBe('Meta');
|
||||
|
||||
if (browserName === 'firefox' && browserMajorVersion <= 117)
|
||||
expect(code).toBe('OSLeft');
|
||||
else
|
||||
expect(code).toBe('MetaLeft');
|
||||
|
||||
if (browserName === 'firefox' && !isMac)
|
||||
expect(metaKey).toBe(false);
|
||||
else
|
||||
expect(metaKey).toBe(true);
|
||||
|
||||
expect(key).toBe('Meta');
|
||||
expect(code).toBe('MetaLeft');
|
||||
expect(metaKey).toBe(true);
|
||||
});
|
||||
|
||||
it('should work with keyboard events with empty.html', async ({ page, server }) => {
|
||||
|
Loading…
Reference in New Issue
Block a user