test: get tests running on macOS again by leveraging built-in platform detection (#5144)

This commit is contained in:
Nick Perez 2024-05-14 14:42:57 +02:00 committed by GitHub
parent cdc147a7f0
commit 1ff58aea21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 15 deletions

View File

@ -58,15 +58,15 @@ context('/src/Marks/Strike/React/', () => {
it('should strike the selected text when the keyboard shortcut is pressed', () => {
cy.get('.tiptap')
.trigger('keydown', { ctrlKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { modKey: true, shiftKey: true, key: 's' })
.find('s')
.should('contain', 'Example Text')
})
it('should toggle the selected text striked when the keyboard shortcut is pressed', () => {
cy.get('.tiptap')
.trigger('keydown', { ctrlKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { ctrlKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { modKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { modKey: true, shiftKey: true, key: 's' })
.find('s')
.should('not.exist')
})

View File

@ -64,15 +64,15 @@ context('/src/Marks/Strike/Vue/', () => {
it('should strike the selected text when the keyboard shortcut is pressed', () => {
cy.get('.tiptap')
.trigger('keydown', { ctrlKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { modKey: true, shiftKey: true, key: 's' })
.find('s')
.should('contain', 'Example Text')
})
it('should toggle the selected text striked when the keyboard shortcut is pressed', () => {
cy.get('.tiptap')
.trigger('keydown', { ctrlKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { ctrlKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { modKey: true, shiftKey: true, key: 's' })
.trigger('keydown', { modKey: true, shiftKey: true, key: 's' })
.find('s')
.should('not.exist')
})

View File

@ -1,5 +1,4 @@
import {
isMacOS,
Mark,
markInputRule,
markPasteRule,
@ -98,15 +97,9 @@ export const Strike = Mark.create<StrikeOptions>({
},
addKeyboardShortcuts() {
const shortcuts: Record<string, () => boolean> = {}
if (isMacOS()) {
shortcuts['Mod-Shift-s'] = () => this.editor.commands.toggleStrike()
} else {
shortcuts['Ctrl-Shift-s'] = () => this.editor.commands.toggleStrike()
return {
'Mod-Shift-s': () => this.editor.commands.toggleStrike(),
}
return shortcuts
},
addInputRules() {