mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(keyboard): support simple cut-pasting using meta+x/v (#18756)
This commit is contained in:
parent
23e02dd006
commit
0c6a0f40c6
@ -127,6 +127,7 @@ export const macEditingCommands: {[key: string]: string|string[]} = {
|
||||
|
||||
'Meta+KeyA': 'selectAll:',
|
||||
'Meta+KeyC': 'copy:',
|
||||
'Meta+KeyX': 'cut:',
|
||||
'Meta+KeyV': 'paste:',
|
||||
'Meta+KeyZ': 'undo:',
|
||||
'Shift+Meta+KeyZ': 'redo:',
|
||||
|
@ -482,6 +482,17 @@ it('should support simple copy-pasting', async ({ page, isMac, browserName }) =>
|
||||
expect(await page.evaluate(() => document.querySelector('div').textContent)).toBe('123123');
|
||||
});
|
||||
|
||||
it('should support simple cut-pasting', async ({ page, isMac }) => {
|
||||
const modifier = isMac ? 'Meta' : 'Control';
|
||||
await page.setContent(`<div contenteditable>123</div>`);
|
||||
await page.focus('div');
|
||||
await page.keyboard.press(`${modifier}+KeyA`);
|
||||
await page.keyboard.press(`${modifier}+KeyX`);
|
||||
await page.keyboard.press(`${modifier}+KeyV`);
|
||||
await page.keyboard.press(`${modifier}+KeyV`);
|
||||
expect(await page.evaluate(() => document.querySelector('div').textContent)).toBe('123123');
|
||||
});
|
||||
|
||||
it('should support undo-redo', async ({ page, isMac, browserName, isLinux }) => {
|
||||
it.fixme(browserName === 'webkit' && isLinux, 'https://github.com/microsoft/playwright/issues/12000');
|
||||
const modifier = isMac ? 'Meta' : 'Control';
|
||||
|
Loading…
x
Reference in New Issue
Block a user