Files
tiptap/docs/src/demos/Extensions/History/index.spec.js
Philipp Kühn 2cf8137def fix tests
2020-11-13 12:33:25 +01:00

54 lines
1.4 KiB
JavaScript

context('/api/extensions/history', () => {
before(() => {
cy.visit('/api/extensions/history')
})
beforeEach(() => {
cy.get('.ProseMirror').then(([{ editor }]) => {
editor.commands.setContent('<p>Mistake</p>')
})
})
it('should make the last change undone', () => {
cy.get('.ProseMirror')
.should('contain', 'Mistake')
cy.get('.demo__preview button:first')
.click()
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' })
.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()
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
cy.get('.demo__preview button:nth-child(2)')
.click()
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' })
.should('not.contain', 'Mistake')
.trigger('keydown', { modKey: true, shiftKey: true, key: 'z' })
.should('contain', 'Mistake')
})
})