add shortcuts to bold and italic tests

This commit is contained in:
Hans Pagel
2020-09-04 14:31:11 +02:00
parent 3f0eac922d
commit 050677d544
2 changed files with 22 additions and 2 deletions

View File

@@ -10,14 +10,24 @@ context('/api/extensions/bold', () => {
})
describe('bold', () => {
it('should make the selected text bold', () => {
it('the button should make the selected text bold', () => {
cy.get('.demo__preview button:first').click({ force: true })
cy.get('.ProseMirror').contains('strong', 'Example Text')
})
it('should toggle the selected text bold', () => {
it('the button should toggle the selected text bold', () => {
cy.get('.demo__preview button:first').dblclick({ force: true })
cy.get('.ProseMirror strong').should('not.exist')
})
it('the keyboard shortcut should make the selected text bold', () => {
cy.get('.ProseMirror').type('{meta}b', {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})
cy.get('.ProseMirror strong').should('not.exist')
})
})
})

View File

@@ -19,5 +19,15 @@ context('/api/extensions/italic', () => {
cy.get('.demo__preview button:first').dblclick({ force: true })
cy.get('.ProseMirror em').should('not.exist')
})
it('the keyboard shortcut should make the selected text italic', () => {
cy.get('.ProseMirror').type('{meta}i', {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})
cy.get('.ProseMirror em').should('not.exist')
})
})
})