mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 14:59:27 +08:00
test: get tests running on macOS again by leveraging built-in platform detection (#5144)
This commit is contained in:
parent
cdc147a7f0
commit
1ff58aea21
@ -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')
|
||||
})
|
||||
|
@ -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')
|
||||
})
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user