diff --git a/docs/src/demos/Examples/Basic/tests/clearContent.spec.js b/docs/src/demos/Examples/Basic/tests/clearContent.spec.js new file mode 100644 index 00000000..c6a25ffe --- /dev/null +++ b/docs/src/demos/Examples/Basic/tests/clearContent.spec.js @@ -0,0 +1,25 @@ +context('clearContent', () => { + before(() => { + cy.visit('/examples/basic') + }) + + it('returns true for the clearContent command', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('
Example Text
') + + const command = editor.commands.clearContent() + + expect(command).to.be.eq(true) + }) + }) + + it('clears the content when using the clearContent command', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('Example Text
') + + editor.commands.clearContent() + + expect(editor.getHTML()).to.be.eq('') + }) + }) +}) diff --git a/docs/src/demos/Examples/Basic/tests/insertHTML.spec.js b/docs/src/demos/Examples/Basic/tests/insertHTML.spec.js new file mode 100644 index 00000000..c8b9d881 --- /dev/null +++ b/docs/src/demos/Examples/Basic/tests/insertHTML.spec.js @@ -0,0 +1,25 @@ +context('insertHTML', () => { + before(() => { + cy.visit('/examples/basic') + }) + + it('returns true for the insertHTML command', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('Example Text
') + + const command = editor.commands.insertHTML('Cindy Lauper
') + + expect(command).to.be.eq(true) + }) + }) + + it('appends the content when using the insertHTML command', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('Example Text
') + + editor.commands.insertHTML('Cindy Lauper
') + + expect(editor.getHTML()).to.be.eq('Example Text
Cindy Lauper
') + }) + }) +}) diff --git a/docs/src/demos/Examples/Basic/tests/setContent.spec.js b/docs/src/demos/Examples/Basic/tests/setContent.spec.js new file mode 100644 index 00000000..b85bc461 --- /dev/null +++ b/docs/src/demos/Examples/Basic/tests/setContent.spec.js @@ -0,0 +1,21 @@ +context('setContent', () => { + before(() => { + cy.visit('/examples/basic') + }) + + it('returns true for the setContent command', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + const command = editor.commands.setContent('Example Text
') + + expect(command).to.be.eq(true) + }) + }) + + it('clears the content when using the setContent command', () => { + cy.get('.ProseMirror').then(([{ editor }]) => { + editor.commands.setContent('Cindy Lauper
') + + expect(editor.getHTML()).to.be.eq('Cindy Lauper
') + }) + }) +}) diff --git a/tests/cypress/integration/core/clearContent.spec.ts b/tests/cypress/integration/core/clearContent.spec.ts deleted file mode 100644 index 269aed1c..00000000 --- a/tests/cypress/integration/core/clearContent.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -///Cindy Lauper
') - - expect(command).to.be.eq(true) - }) - - it('appends the content when using insertHTML', () => { - const editor = new Editor({ - extensions: [ - Document, - Paragraph, - Text, - ], - }) - - editor.commands.insertHTML('Cindy Lauper
') - - expect(editor.getHTML()).to.eq('Cindy Lauper
') - }) -}) diff --git a/tests/cypress/integration/core/setContent.spec.ts b/tests/cypress/integration/core/setContent.spec.ts deleted file mode 100644 index e3920662..00000000 --- a/tests/cypress/integration/core/setContent.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -///Cindy Lauper
') - - expect(command).to.be.eq(true) - }) - - it('replaces the content when using setContent', () => { - const editor = new Editor({ - extensions: [ - Document, - Paragraph, - Text, - ], - }) - - editor.commands.setContent('Cindy Lauper
') - - expect(editor.getHTML()).to.eq('Cindy Lauper
') - }) -})