refactoring

This commit is contained in:
Philipp Kühn
2020-09-15 00:07:00 +02:00
parent 61ca7d4377
commit 71cc626b0a
12 changed files with 307 additions and 123 deletions

View File

@@ -10,21 +10,36 @@ context('/api/extensions/paragraph', () => {
})
it('text should be wrapped in a paragraph by default', () => {
cy.get('.ProseMirror').type('Example Text', { force: true })
cy.get('.ProseMirror').find('p').should('contain', 'Example Text')
cy.get('.ProseMirror')
.type('Example Text', { force: true })
.find('p')
.should('contain', 'Example Text')
})
it('enter should make a new paragraph', () => {
cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', { force: true })
cy.get('.ProseMirror').find('p').should('have.length', 2)
cy.get('.ProseMirror').find('p:first').should('contain', 'First Paragraph')
cy.get('.ProseMirror').find('p:nth-child(2)').should('contain', 'Second Paragraph')
cy.get('.ProseMirror')
.type('First Paragraph{enter}Second Paragraph', { force: true })
.find('p')
.should('have.length', 2)
cy.get('.ProseMirror')
.find('p:first')
.should('contain', 'First Paragraph')
cy.get('.ProseMirror')
.find('p:nth-child(2)')
.should('contain', 'Second Paragraph')
})
it('backspace should remove the second paragraph', () => {
cy.get('.ProseMirror').type('{enter}', { force: true })
cy.get('.ProseMirror').find('p').should('have.length', 2)
cy.get('.ProseMirror').type('{backspace}', { force: true })
cy.get('.ProseMirror').find('p').should('have.length', 1)
cy.get('.ProseMirror')
.type('{enter}', { force: true })
.find('p')
.should('have.length', 2)
cy.get('.ProseMirror')
.type('{backspace}', { force: true })
.find('p')
.should('have.length', 1)
})
})