diff --git a/docs/src/demos/Examples/History/index.spec.js b/docs/src/demos/Examples/History/index.spec.js index d1f6a695..dd7ffd92 100644 --- a/docs/src/demos/Examples/History/index.spec.js +++ b/docs/src/demos/Examples/History/index.spec.js @@ -5,16 +5,12 @@ context('/examples/history', () => { it('should not have a mistake', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - const html = editor.html() - cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') }) }) it('should have a mistake', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - const html = editor.html() - editor.insertText('Mistake') cy.get('.ProseMirror h2:first').should('contain', 'Mistake') }) @@ -22,8 +18,6 @@ context('/examples/history', () => { it('the mistake should be removed again', () => { cy.get('.ProseMirror').then(([{ editor }]) => { - const html = editor.html() - editor.undo() cy.get('.ProseMirror h2:first').should('not.contain', 'Mistake') }) diff --git a/docs/src/demos/Extensions/HardBreak/index.spec.js b/docs/src/demos/Extensions/HardBreak/index.spec.js index 016e34d1..13da3725 100644 --- a/docs/src/demos/Extensions/HardBreak/index.spec.js +++ b/docs/src/demos/Extensions/HardBreak/index.spec.js @@ -3,9 +3,11 @@ context('/api/extensions/hard-break', () => { cy.visit('/api/extensions/hard-break') }) - beforeEach(() => { + beforeEach(done => { cy.get('.ProseMirror').then(([{ editor }]) => { + editor.focus() editor.setContent('
Example Text
') + done() }) }) diff --git a/docs/src/demos/Extensions/History/index.spec.js b/docs/src/demos/Extensions/History/index.spec.js index 43dc7e47..421f8b55 100644 --- a/docs/src/demos/Extensions/History/index.spec.js +++ b/docs/src/demos/Extensions/History/index.spec.js @@ -3,15 +3,16 @@ context('/api/extensions/history', () => { cy.visit('/api/extensions/history') }) - beforeEach(() => { + beforeEach(done => { cy.get('.ProseMirror').then(([{ editor }]) => { + editor.focus() editor.setContent('Mistake
') + done() }) }) 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('.ProseMirror').should('not.contain', 'Mistake') }) @@ -22,12 +23,11 @@ context('/api/extensions/history', () => { }) 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('.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').contains('Mistake') }) 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').type('{meta}{shift}z', { force: true }) - cy.get('.ProseMirror').should('contain', 'Mistake') + cy.get('.ProseMirror').contains('Mistake') }) }) diff --git a/docs/src/demos/Extensions/Paragraph/index.spec.js b/docs/src/demos/Extensions/Paragraph/index.spec.js index 3137b6e3..6a96a6f3 100644 --- a/docs/src/demos/Extensions/Paragraph/index.spec.js +++ b/docs/src/demos/Extensions/Paragraph/index.spec.js @@ -13,15 +13,14 @@ context('/api/extensions/paragraph', () => { it('text should be wrapped in a paragraph by default', () => { cy.get('.ProseMirror').type('Example Text', { force: true }) - cy.get('.ProseMirror').contains('p', 'Example Text') - cy.get('.ProseMirror').find('p').should('have.length', 1) + cy.get('.ProseMirror').find('p').should('contain', 'Example Text') }) it('enter should make a new paragraph', () => { cy.get('.ProseMirror').type('First Paragraph{enter}Second Paragraph', { force: true }) cy.get('.ProseMirror').find('p').should('have.length', 2) - cy.get('.ProseMirror').contains('p:first', 'First Paragraph') - cy.get('.ProseMirror').contains('p:nth-child(2)', 'Second Paragraph') + cy.get('.ProseMirror').find('p:first').should('contain', 'First Paragraph') + cy.get('.ProseMirror').find('p:nth-child(2)').should('contain', 'Second Paragraph') }) it('backspace should remove the second paragraph', () => {