mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-29 08:19:34 +08:00
refactor platform related shortcuts
This commit is contained in:
parent
050677d544
commit
d9eaedd194
@ -21,12 +21,16 @@ context('/api/extensions/bold', () => {
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should make the selected text bold', () => {
|
||||
cy.get('.ProseMirror').type('{meta}b', {force: true})
|
||||
const shortcut = Cypress.platform === 'darwin' ? '{meta}b' : '{ctrl}b'
|
||||
|
||||
cy.get('.ProseMirror').type(shortcut, {force: true})
|
||||
cy.get('.ProseMirror').contains('strong', 'Example Text')
|
||||
})
|
||||
|
||||
it('the button should toggle the selected text bold', () => {
|
||||
cy.get('.ProseMirror').type('{meta}b', {force: true}).type('{meta}b', {force: true})
|
||||
const shortcut = Cypress.platform === 'darwin' ? '{meta}b' : '{ctrl}b'
|
||||
|
||||
cy.get('.ProseMirror').type(shortcut, {force: true}).type(shortcut, {force: true})
|
||||
cy.get('.ProseMirror strong').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
@ -21,12 +21,16 @@ context('/api/extensions/italic', () => {
|
||||
})
|
||||
|
||||
it('the keyboard shortcut should make the selected text italic', () => {
|
||||
cy.get('.ProseMirror').type('{meta}i', {force: true})
|
||||
const shortcut = Cypress.platform === 'darwin' ? '{meta}i' : '{ctrl}i'
|
||||
|
||||
cy.get('.ProseMirror').type(shortcut, {force: true})
|
||||
cy.get('.ProseMirror').contains('em', 'Example Text')
|
||||
})
|
||||
|
||||
it('the button should toggle the selected text italic', () => {
|
||||
cy.get('.ProseMirror').type('{meta}i', {force: true}).type('{meta}i', {force: true})
|
||||
const shortcut = Cypress.platform === 'darwin' ? '{meta}i' : '{ctrl}i'
|
||||
|
||||
cy.get('.ProseMirror').type(shortcut, {force: true}).type(shortcut, {force: true})
|
||||
cy.get('.ProseMirror em').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user