fix shortcuts

This commit is contained in:
Philipp Kühn
2020-09-11 23:17:40 +02:00
parent c7af0b6782
commit 7afcb0250e
8 changed files with 38 additions and 20 deletions

View File

@@ -23,3 +23,21 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.overwrite('trigger', (originalFn, element, text, options) => {
if (text === 'keydown') {
const isMac = Cypress.platform === 'darwin'
const { modKey, ...rest } = options
if (modKey) {
const newOptions = {
...rest,
...(isMac ? { metaKey: modKey } : { ctrlKey: modKey }),
}
return originalFn(element, text, newOptions)
}
}
return originalFn(element, text, options)
})