refactor platform related shortcuts

This commit is contained in:
Hans Pagel 2020-09-04 14:37:26 +02:00
parent 050677d544
commit d9eaedd194
2 changed files with 12 additions and 4 deletions

View File

@ -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')
})
})

View File

@ -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')
})
})