test(examples): add test for tasks vue example

This commit is contained in:
Dominik Biedebach
2022-05-13 00:56:55 +02:00
committed by Dominik
parent 7b3374efdf
commit 7d25030e80

View File

@@ -3,5 +3,30 @@ context('/src/Examples/Tasks/Vue/', () => {
cy.visit('/src/Examples/Tasks/Vue/')
})
// TODO: Write tests
beforeEach(() => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.clearContent()
})
})
it('should always use task items', () => {
cy.get('.ProseMirror input[type="checkbox"]').should('have.length', 1)
})
it('should create new tasks', () => {
cy.get('.ProseMirror').type('Cook food{enter}Eat food{enter}Clean dishes')
cy.get('.ProseMirror input[type="checkbox"]').should('have.length', 3)
})
it('should check and uncheck tasks on click', () => {
cy.get('.ProseMirror').type('Cook food{enter}Eat food{enter}Clean dishes')
cy.get('.ProseMirror').find('input[type="checkbox"]').eq(0).click({ force: true })
cy.get('.ProseMirror').find('input[type="checkbox"]:checked').should('have.length', 1)
cy.get('.ProseMirror').find('input[type="checkbox"]').eq(1).click({ force: true })
cy.get('.ProseMirror').find('input[type="checkbox"]:checked').should('have.length', 2)
cy.get('.ProseMirror').find('input[type="checkbox"]').eq(0).click({ force: true })
cy.get('.ProseMirror').find('input[type="checkbox"]:checked').should('have.length', 1)
cy.get('.ProseMirror').find('input[type="checkbox"]').eq(1).click({ force: true })
cy.get('.ProseMirror').find('input[type="checkbox"]:checked').should('have.length', 0)
})
})