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,29 +10,44 @@ context('/api/extensions/history', () => {
})
it('should make the last change undone', () => {
cy.get('.ProseMirror').should('contain', 'Mistake')
cy.get('.demo__preview button:first').click({ force: true })
cy.get('.ProseMirror').should('not.contain', 'Mistake')
cy.get('.ProseMirror')
.should('contain', 'Mistake')
cy.get('.demo__preview button:first')
.click({ force: true })
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
})
it('the keyboard shortcut should make the last change undone', () => {
cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'z' })
cy.get('.ProseMirror').should('not.contain', 'Mistake')
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'z' })
.should('not.contain', 'Mistake')
})
it('should apply the last undone change again', () => {
cy.get('.ProseMirror').should('contain', 'Mistake')
cy.get('.demo__preview button:first').click({ force: true })
cy.get('.ProseMirror').should('not.contain', 'Mistake')
cy.get('.demo__preview button:nth-child(2)').click({ force: true })
cy.get('.ProseMirror').should('contain', 'Mistake')
cy.get('.ProseMirror')
.should('contain', 'Mistake')
cy.get('.demo__preview button:first')
.click({ force: true })
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
cy.get('.demo__preview button:nth-child(2)')
.click({ force: true })
cy.get('.ProseMirror')
.should('contain', 'Mistake')
})
it.skip('the keyboard shortcut should apply the last undone change again', () => {
cy.get('.ProseMirror').trigger('keydown', { modKey: true, key: 'z' })
cy.get('.ProseMirror').should('not.contain', 'Mistake')
cy.get('.ProseMirror').trigger('keydown', { modKey: true, shiftKey: true, key: 'z' })
cy.get('.ProseMirror').should('contain', 'Mistake')
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'z' })
.should('not.contain', 'Mistake')
.trigger('keydown', { modKey: true, shiftKey: true, key: 'z' })
.should('contain', 'Mistake')
})
})