add extension demos

This commit is contained in:
Philipp Kühn
2021-08-25 18:03:42 +02:00
parent 6ab708b1a2
commit 88804668ff
44 changed files with 1695 additions and 1 deletions

View File

@@ -0,0 +1,123 @@
context('/demos/Extensions/History', () => {
beforeEach(() => {
cy.visit('/demos/Extensions/History')
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('button:first')
.should('not.have.attr', 'disabled')
cy.get('button:first')
.click()
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
})
it('should make the last change undone with the keyboard shortcut', () => {
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'z' })
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
})
it('should make the last change undone with the keyboard shortcut (russian)', () => {
cy.get('.ProseMirror')
.should('contain', 'Mistake')
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'я' })
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
})
it('should apply the last undone change again with the keyboard shortcut', () => {
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')
})
it('should apply the last undone change again with the keyboard shortcut (russian)', () => {
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, key: 'я' })
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
cy.get('.ProseMirror')
.trigger('keydown', { modKey: true, shiftKey: true, key: 'я' })
cy.get('.ProseMirror')
.should('contain', 'Mistake')
})
it('should apply the last undone change again', () => {
cy.get('.ProseMirror')
.should('contain', 'Mistake')
cy.get('button:first')
.should('not.have.attr', 'disabled')
cy.get('button:first')
.click()
cy.get('.ProseMirror')
.should('not.contain', 'Mistake')
cy.get('button:first')
.should('have.attr', 'disabled')
cy.get('button:nth-child(2)')
.click()
cy.get('.ProseMirror')
.should('contain', 'Mistake')
})
it('should disable undo button when there are no more changes to undo', () => {
cy.get('.ProseMirror')
.should('contain', 'Mistake')
cy.get('button:first')
.should('not.have.attr', 'disabled')
cy.get('button:first')
.click()
cy.get('button:first')
.should('have.attr', 'disabled')
})
it('should disable redo button when there are no more changes to redo', () => {
cy.get('.ProseMirror')
.should('contain', 'Mistake')
cy.get('button:nth-child(2)')
.should('have.attr', 'disabled')
cy.get('button:first')
.should('not.have.attr', 'disabled')
cy.get('button:first')
.click()
cy.get('button:nth-child(2)')
.should('not.have.attr', 'disabled')
})
})