update some tests

This commit is contained in:
Philipp Kühn
2020-09-11 21:04:55 +02:00
parent 8df2a5d25e
commit 46cee66db9
4 changed files with 13 additions and 18 deletions

View File

@@ -5,16 +5,12 @@ context('/examples/history', () => {
it('should not have a mistake', () => { it('should not have a mistake', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
const html = editor.html()
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
}) })
}) })
it('should have a mistake', () => { it('should have a mistake', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
const html = editor.html()
editor.insertText('Mistake') editor.insertText('Mistake')
cy.get('.ProseMirror h2:first').should('contain', 'Mistake') cy.get('.ProseMirror h2:first').should('contain', 'Mistake')
}) })
@@ -22,8 +18,6 @@ context('/examples/history', () => {
it('the mistake should be removed again', () => { it('the mistake should be removed again', () => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
const html = editor.html()
editor.undo() editor.undo()
cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake')
}) })

View File

@@ -3,9 +3,11 @@ context('/api/extensions/hard-break', () => {
cy.visit('/api/extensions/hard-break') cy.visit('/api/extensions/hard-break')
}) })
beforeEach(() => { beforeEach(done => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.focus()
editor.setContent('<p>Example Text</p>') editor.setContent('<p>Example Text</p>')
done()
}) })
}) })

View File

@@ -3,15 +3,16 @@ context('/api/extensions/history', () => {
cy.visit('/api/extensions/history') cy.visit('/api/extensions/history')
}) })
beforeEach(() => { beforeEach(done => {
cy.get('.ProseMirror').then(([{ editor }]) => { cy.get('.ProseMirror').then(([{ editor }]) => {
editor.focus()
editor.setContent('<p>Mistake</p>') editor.setContent('<p>Mistake</p>')
done()
}) })
}) })
it('should make the last change undone', () => { it('should make the last change undone', () => {
cy.get('.ProseMirror').should('contain', 'Mistake') cy.get('.ProseMirror').contains('Mistake')
cy.get('.demo__preview button:first').click({ force: true }) cy.get('.demo__preview button:first').click({ force: true })
cy.get('.ProseMirror').should('not.contain', 'Mistake') cy.get('.ProseMirror').should('not.contain', 'Mistake')
}) })
@@ -22,12 +23,11 @@ context('/api/extensions/history', () => {
}) })
it('should apply the last undone change again', () => { it('should apply the last undone change again', () => {
cy.get('.ProseMirror').should('contain', 'Mistake') cy.get('.ProseMirror').contains('Mistake')
cy.get('.demo__preview button:first').click({ force: true }) cy.get('.demo__preview button:first').click({ force: true })
cy.get('.ProseMirror').should('not.contain', 'Mistake') cy.get('.ProseMirror').should('not.contain', 'Mistake')
cy.get('.demo__preview button:nth-child(2)').click({ force: true }) cy.get('.demo__preview button:nth-child(2)').click({ force: true })
cy.get('.ProseMirror').should('contain', 'Mistake') cy.get('.ProseMirror').contains('Mistake')
}) })
it.skip('the keyboard shortcut should apply the last undone change again', () => { it.skip('the keyboard shortcut should apply the last undone change again', () => {
@@ -35,6 +35,6 @@ context('/api/extensions/history', () => {
cy.get('.ProseMirror').should('not.contain', 'Mistake') cy.get('.ProseMirror').should('not.contain', 'Mistake')
cy.get('.ProseMirror').type('{meta}{shift}z', { force: true }) cy.get('.ProseMirror').type('{meta}{shift}z', { force: true })
cy.get('.ProseMirror').should('contain', 'Mistake') cy.get('.ProseMirror').contains('Mistake')
}) })
}) })

View File

@@ -13,15 +13,14 @@ context('/api/extensions/paragraph', () => {
it('text should be wrapped in a paragraph by default', () => { it('text should be wrapped in a paragraph by default', () => {
cy.get('.ProseMirror').type('Example Text', { force: true }) cy.get('.ProseMirror').type('Example Text', { force: true })
cy.get('.ProseMirror').contains('p', 'Example Text') cy.get('.ProseMirror').find('p').should('contain', 'Example Text')
cy.get('.ProseMirror').find('p').should('have.length', 1)
}) })
it('enter should make a new paragraph', () => { it('enter should make a new paragraph', () => {
cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', { force: true }) cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', { force: true })
cy.get('.ProseMirror').find('p').should('have.length', 2) cy.get('.ProseMirror').find('p').should('have.length', 2)
cy.get('.ProseMirror').contains('p:first', 'First Paragraph') cy.get('.ProseMirror').find('p:first').should('contain', 'First Paragraph')
cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph') cy.get('.ProseMirror').find('p:nth-child(2)').should('contain', 'Second Paragraph')
}) })
it('backspace should remove the second paragraph', () => { it('backspace should remove the second paragraph', () => {