really fix tests

This commit is contained in:
Hans Pagel
2020-09-11 15:57:33 +02:00
parent 2e67d64d68
commit 1b414ab33c
20 changed files with 501 additions and 514 deletions

View File

@@ -1,32 +1,33 @@
context('/api/extensions/paragraph', () => {
beforeEach(() => {
before(() => {
cy.visit('/api/extensions/paragraph')
})
beforeEach(() => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
editor.clearContent()
cy.wait(10)
})
})
describe('paragraph', () => {
it('text should be wrapped in a paragraph by default', () => {
cy.get('.ProseMirror').type('Example Text', {force: true})
cy.get('.ProseMirror').contains('p', 'Example Text')
cy.get('.ProseMirror').find('p').should('have.length', 1)
})
it('text should be wrapped in a paragraph by default', () => {
cy.get('.ProseMirror').type('Example Text', { force: true })
cy.get('.ProseMirror').contains('p', 'Example Text')
cy.get('.ProseMirror').find('p').should('have.length', 1)
})
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').contains('p:first', 'First Paragraph')
cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph')
})
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').contains('p:first', 'First Paragraph')
cy.get('.ProseMirror').contains('p:nth-child(2)', '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)
})
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)
})
})