add a history example with tests

This commit is contained in:
Hans Pagel
2020-08-31 18:11:17 +02:00
parent ae7c5fa834
commit ccdb0c7f89
4 changed files with 86 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
context('history', () => {
beforeEach(() => {
cy.visit('/examples/history')
})
describe('undo', () => {
it('should not have a mistake', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
const html = editor.html()
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
})
})
it('should have a mistake', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
const html = editor.html()
editor.insertText('Mistake')
cy.get('.ProseMirror h2:first').should('contain', 'Mistake')
})
})
it('the mistake should be removed again', () => {
cy.get('.ProseMirror').window().then(window => {
const { editor } = window
const html = editor.html()
editor.undo()
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
})
})
})
})