diff --git a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js index dca1567c..cee0070a 100644 --- a/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js +++ b/docs/src/demos/Examples/MarkdownShortcuts/index.spec.js @@ -3,89 +3,101 @@ context('/examples/markdown-shortcuts', () => { cy.visit('/examples/markdown-shortcuts') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.focus() editor.clearContent() - done() }) }) it('should make a h1', () => { cy.get('.ProseMirror') .type('# Headline', { force: true }) - .contains('h1', 'Headline') + .find('h1') + .should('contain', 'Headline') }) it('should make a h2', () => { cy.get('.ProseMirror') .type('## Headline', { force: true }) - .contains('h2', 'Headline') + .find('h2') + .should('contain', 'Headline') }) it('should make a h3', () => { cy.get('.ProseMirror') .type('### Headline', { force: true }) - .contains('h3', 'Headline') + .find('h3') + .should('contain', 'Headline') }) it('should make a h4', () => { cy.get('.ProseMirror') .type('#### Headline', { force: true }) - .contains('h4', 'Headline') + .find('h4') + .should('contain', 'Headline') }) it('should make a h5', () => { cy.get('.ProseMirror') .type('##### Headline', { force: true }) - .contains('h5', 'Headline') + .find('h5') + .should('contain', 'Headline') }) it('should make a h6', () => { cy.get('.ProseMirror') .type('###### Headline', { force: true }) - .contains('h6', 'Headline') + .find('h6') + .should('contain', 'Headline') }) it('should create inline code', () => { cy.get('.ProseMirror') .type('`$foobar`', { force: true }) - .contains('code', '$foobar') + .find('code') + .should('contain', '$foobar') }) it.skip('should create a code block without language', () => { cy.get('.ProseMirror') .type('``` {enter}const foo = bar{enter}```', { force: true }) - .contains('pre', 'const foo = bar') + .find('pre') + .should('contain', 'const foo = bar') }) it.skip('should create a bullet list from asteriks', () => { cy.get('.ProseMirror') .type('* foobar', { force: true }) - .contains('ul', 'foobar') + .find('ul') + .should('contain', 'foobar') }) it.skip('should create a bullet list from dashes', () => { cy.get('.ProseMirror') .type('- foobar', { force: true }) - .contains('ul', 'foobar') + .find('ul') + .should('contain', 'foobar') }) it.skip('should create a bullet list from pluses', () => { cy.get('.ProseMirror') .type('+ foobar', { force: true }) - .contains('ul', 'foobar') + .find('ul') + .should('contain', 'foobar') }) it.skip('should create a ordered list', () => { cy.get('.ProseMirror') .type('1. foobar', { force: true }) - .contains('ol', 'foobar') + .find('ol') + .should('contain', 'foobar') }) it.skip('should create a blockquote', () => { cy.get('.ProseMirror') .type('> foobar', { force: true }) - .contains('blockquote', 'foobar') + .find('blockquote') + .should('contain', 'foobar') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Blockquote/index.spec.js b/docs/src/demos/Extensions/Blockquote/index.spec.js index 65063acb..94b9fd74 100644 --- a/docs/src/demos/Extensions/Blockquote/index.spec.js +++ b/docs/src/demos/Extensions/Blockquote/index.spec.js @@ -3,25 +3,24 @@ context('/api/extensions/blockquote', () => { cy.visit('/api/extensions/blockquote') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('
Example Text
') editor.focus() editor.selectAll() - done() }) }) it('the button should make the selected line a blockquote', () => { cy.get('.ProseMirror blockquote').should('not.exist') cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') + cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') }) it('the button should toggle the blockquote', () => { cy.get('.ProseMirror blockquote').should('not.exist') cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') + cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') cy.get('.ProseMirror').type('{selectall}', { force: true }) cy.get('.demo__preview button:first').click({ force: true }) @@ -29,23 +28,24 @@ context('/api/extensions/blockquote', () => { }) it('the keyboard shortcut should make the selected line a blockquote', () => { - cy.get('.ProseMirror').type('{meta}{shift}9', { force: true }) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') + cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, metaKey: true, keyCode: 57 }) + cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the blockquote', () => { cy.get('.ProseMirror blockquote').should('not.exist') - cy.get('.ProseMirror').type('{meta}{shift}9', { force: true }) - cy.get('.ProseMirror').contains('blockquote', 'Example Text') + cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, metaKey: true, keyCode: 57 }) + cy.get('.ProseMirror').find('blockquote').should('contain', 'Example Text') cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.ProseMirror').type('{meta}{shift}9', { force: true }) + cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, metaKey: true, keyCode: 57 }) cy.get('.ProseMirror blockquote').should('not.exist') }) it('should make a blockquote from markdown shortcuts', () => { cy.get('.ProseMirror') .type('> Quote', { force: true }) - .contains('blockquote', 'Quote') + .find('blockquote') + .should('contain', 'Quote') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Bold/index.spec.js b/docs/src/demos/Extensions/Bold/index.spec.js index f882cbf4..e0669fe4 100644 --- a/docs/src/demos/Extensions/Bold/index.spec.js +++ b/docs/src/demos/Extensions/Bold/index.spec.js @@ -3,18 +3,17 @@ context('/api/extensions/bold', () => { cy.visit('/api/extensions/bold') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('Example Text
') editor.focus() editor.selectAll() - done() }) }) it('the button should make the selected text bold', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('strong', 'Example Text') + cy.get('.ProseMirror').find('strong').should('contain', 'Example Text') }) it('the button should toggle the selected text bold', () => { @@ -27,13 +26,15 @@ context('/api/extensions/bold', () => { it('the keyboard shortcut should make the selected text bold', () => { cy.get('.ProseMirror') .type('{meta}b', { force: true }) - .contains('strong', 'Example Text') + .find('strong') + .should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the selected text bold', () => { cy.get('.ProseMirror') .type('{meta}b', { force: true }) - .contains('strong', 'Example Text') + .find('strong') + .should('contain', 'Example Text') cy.get('.ProseMirror') .type('{meta}b', { force: true }) @@ -44,12 +45,14 @@ context('/api/extensions/bold', () => { it('should make a bold text from the default markdown shortcut', () => { cy.get('.ProseMirror') .type('**Bold**', { force: true }) - .contains('strong', 'Bold') + .find('strong') + .should('contain', 'Bold') }) it('should make a bold text from the alternative markdown shortcut', () => { cy.get('.ProseMirror') .type('__Bold__', { force: true }) - .contains('strong', 'Bold') + .find('strong') + .should('contain', 'Bold') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Code/index.spec.js b/docs/src/demos/Extensions/Code/index.spec.js index 014022f4..1511919d 100644 --- a/docs/src/demos/Extensions/Code/index.spec.js +++ b/docs/src/demos/Extensions/Code/index.spec.js @@ -3,18 +3,17 @@ context('/api/extensions/code', () => { cy.visit('/api/extensions/code') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('Example Text
') editor.focus() editor.selectAll() - done() }) }) it('should mark the selected text as inline code', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('code', 'Example Text') + cy.get('.ProseMirror').find('code').should('contain', 'Example Text') }) it('should toggle the selected text as inline code', () => { diff --git a/docs/src/demos/Extensions/CodeBlock/index.spec.js b/docs/src/demos/Extensions/CodeBlock/index.spec.js index 1ec26c72..1741590d 100644 --- a/docs/src/demos/Extensions/CodeBlock/index.spec.js +++ b/docs/src/demos/Extensions/CodeBlock/index.spec.js @@ -3,23 +3,22 @@ context('/api/extensions/code-block', () => { cy.visit('/api/extensions/code-block') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('Example Text
') editor.focus() editor.selectAll() - done() }) }) it('the button should make the selected line a code block', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('pre', 'Example Text') + cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') }) it('the button should toggle the code block', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('pre', 'Example Text') + cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') cy.get('.ProseMirror').type('{selectall}', { force: true }) cy.get('.demo__preview button:first').click({ force: true }) @@ -27,22 +26,23 @@ context('/api/extensions/code-block', () => { }) it('the keyboard shortcut should make the selected line a code block', () => { - cy.get('.ProseMirror').type('{control}{shift}\\', { force: true }) - cy.get('.ProseMirror').contains('pre', 'Example Text') + cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, keyCode: 220 }) + cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the code block', () => { - cy.get('.ProseMirror').type('{control}{shift}\\', { force: true }) - cy.get('.ProseMirror').contains('pre', 'Example Text') + cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, keyCode: 220 }) + cy.get('.ProseMirror').find('pre').should('contain', 'Example Text') cy.get('.ProseMirror').type('{selectall}', { force: true }) - cy.get('.ProseMirror').type('{control}{shift}\\', { force: true }) + cy.get('.ProseMirror').trigger('keydown', { shiftKey: true, ctrlKey: true, keyCode: 220 }) cy.get('.ProseMirror pre').should('not.exist') }) it('should make a code block from markdown shortcuts', () => { cy.get('.ProseMirror') .type('``` {enter}Code', { force: true }) - .contains('pre', 'Code') + .find('pre') + .should('contain', 'Code') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/HardBreak/index.spec.js b/docs/src/demos/Extensions/HardBreak/index.spec.js index 13da3725..c044f6b5 100644 --- a/docs/src/demos/Extensions/HardBreak/index.spec.js +++ b/docs/src/demos/Extensions/HardBreak/index.spec.js @@ -3,11 +3,10 @@ context('/api/extensions/hard-break', () => { cy.visit('/api/extensions/hard-break') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.focus() editor.setContent('Example Text
') - done() }) }) diff --git a/docs/src/demos/Extensions/Heading/index.spec.js b/docs/src/demos/Extensions/Heading/index.spec.js index 44003319..f420ccbf 100644 --- a/docs/src/demos/Extensions/Heading/index.spec.js +++ b/docs/src/demos/Extensions/Heading/index.spec.js @@ -3,30 +3,29 @@ context('/api/extensions/heading', () => { cy.visit('/api/extensions/heading') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('Example Text
') editor.focus() editor.selectAll() - done() }) }) it('the button should make the selected line a h1', () => { cy.get('.ProseMirror h1').should('not.exist') cy.get('.demo__preview button:nth-child(1)').click({ force: true }) - cy.get('.ProseMirror').contains('h1', 'Example Text') + cy.get('.ProseMirror').find('h1').should('contain', 'Example Text') }) it('the button should make the selected line a h2', () => { cy.get('.ProseMirror h2').should('not.exist') cy.get('.demo__preview button:nth-child(2)').click({ force: true }) - cy.get('.ProseMirror').contains('h2', 'Example Text') + cy.get('.ProseMirror').find('h2').should('contain', 'Example Text') }) it('the button should make the selected line a h3', () => { cy.get('.ProseMirror h3').should('not.exist') cy.get('.demo__preview button:nth-child(3)').click({ force: true }) - cy.get('.ProseMirror').contains('h3', 'Example Text') + cy.get('.ProseMirror').find('h3').should('contain', 'Example Text') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/History/index.spec.js b/docs/src/demos/Extensions/History/index.spec.js index 421f8b55..f788efe5 100644 --- a/docs/src/demos/Extensions/History/index.spec.js +++ b/docs/src/demos/Extensions/History/index.spec.js @@ -3,16 +3,15 @@ context('/api/extensions/history', () => { cy.visit('/api/extensions/history') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.focus() editor.setContent('Mistake
') - done() }) }) it('should make the last change undone', () => { - cy.get('.ProseMirror').contains('Mistake') + cy.get('.ProseMirror').should('contain', 'Mistake') cy.get('.demo__preview button:first').click({ force: true }) cy.get('.ProseMirror').should('not.contain', 'Mistake') }) @@ -23,11 +22,11 @@ context('/api/extensions/history', () => { }) it('should apply the last undone change again', () => { - cy.get('.ProseMirror').contains('Mistake') + cy.get('.ProseMirror').should('contain', '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').contains('Mistake') + cy.get('.ProseMirror').should('contain', 'Mistake') }) it.skip('the keyboard shortcut should apply the last undone change again', () => { @@ -35,6 +34,6 @@ context('/api/extensions/history', () => { cy.get('.ProseMirror').should('not.contain', 'Mistake') cy.get('.ProseMirror').type('{meta}{shift}z', { force: true }) - cy.get('.ProseMirror').contains('Mistake') + cy.get('.ProseMirror').should('contain', 'Mistake') }) }) diff --git a/docs/src/demos/Extensions/Italic/index.spec.js b/docs/src/demos/Extensions/Italic/index.spec.js index d4dfc35a..95269836 100644 --- a/docs/src/demos/Extensions/Italic/index.spec.js +++ b/docs/src/demos/Extensions/Italic/index.spec.js @@ -3,18 +3,17 @@ context('/api/extensions/italic', () => { cy.visit('/api/extensions/italic') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('Example Text
') editor.focus() editor.selectAll() - done() }) }) it('the button should make the selected text italic', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('em', 'Example Text') + cy.get('.ProseMirror').find('em').should('contain', 'Example Text') }) it('the button should toggle the selected text italic', () => { @@ -26,7 +25,7 @@ context('/api/extensions/italic', () => { it('the keyboard shortcut should make the selected text italic', () => { cy.get('.ProseMirror').type('{meta}i', { force: true }) - cy.get('.ProseMirror').contains('em', 'Example Text') + cy.get('.ProseMirror').find('em').should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the selected text italic', () => { diff --git a/docs/src/demos/Extensions/Paragraph/index.spec.js b/docs/src/demos/Extensions/Paragraph/index.spec.js index 6a96a6f3..0cdc4dfb 100644 --- a/docs/src/demos/Extensions/Paragraph/index.spec.js +++ b/docs/src/demos/Extensions/Paragraph/index.spec.js @@ -3,11 +3,10 @@ context('/api/extensions/paragraph', () => { cy.visit('/api/extensions/paragraph') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.focus() editor.clearContent() - done() }) }) diff --git a/docs/src/demos/Extensions/Strike/index.spec.js b/docs/src/demos/Extensions/Strike/index.spec.js index e1232640..ef868c26 100644 --- a/docs/src/demos/Extensions/Strike/index.spec.js +++ b/docs/src/demos/Extensions/Strike/index.spec.js @@ -3,18 +3,17 @@ context('/api/extensions/strike', () => { cy.visit('/api/extensions/strike') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('Example Text
') editor.focus() editor.selectAll() - done() }) }) it('the button should strike the selected text', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('s', 'Example Text') + cy.get('.ProseMirror').find('s').should('contain', 'Example Text') }) it('the button should toggle the selected text striked', () => { @@ -26,7 +25,7 @@ context('/api/extensions/strike', () => { it('the keyboard shortcut should strike the selected text', () => { cy.get('.ProseMirror').type('{meta}d', { force: true }) - cy.get('.ProseMirror').contains('s', 'Example Text') + cy.get('.ProseMirror').find('s').should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the selected text striked', () => { @@ -37,6 +36,7 @@ context('/api/extensions/strike', () => { it('should make a striked text from the markdown shortcut', () => { cy.get('.ProseMirror') .type('~Strike~', { force: true }) - .contains('s', 'Strike') + .find('s') + .should('contain', 'Strike') }) }) \ No newline at end of file diff --git a/docs/src/demos/Extensions/Underline/index.spec.js b/docs/src/demos/Extensions/Underline/index.spec.js index 951f90d4..400c78e3 100644 --- a/docs/src/demos/Extensions/Underline/index.spec.js +++ b/docs/src/demos/Extensions/Underline/index.spec.js @@ -3,18 +3,17 @@ context('/api/extensions/underline', () => { cy.visit('/api/extensions/underline') }) - beforeEach(done => { + beforeEach(() => { cy.get('.ProseMirror').then(([{ editor }]) => { editor.setContent('Example Text
') editor.focus() editor.selectAll() - done() }) }) it('the button should underline the selected text', () => { cy.get('.demo__preview button:first').click({ force: true }) - cy.get('.ProseMirror').contains('u', 'Example Text') + cy.get('.ProseMirror').find('u').should('contain', 'Example Text') }) it('the button should toggle the selected text underline', () => { @@ -26,7 +25,7 @@ context('/api/extensions/underline', () => { it('the keyboard shortcut should underline the selected text', () => { cy.get('.ProseMirror').type('{meta}u', { force: true }) - cy.get('.ProseMirror').contains('u', 'Example Text') + cy.get('.ProseMirror').find('u').should('contain', 'Example Text') }) it('the keyboard shortcut should toggle the selected text underline', () => {