move insertHTML, setContent, clearContent tests to the basic demo
This commit is contained in:
25
docs/src/demos/Examples/Basic/tests/clearContent.spec.js
Normal file
25
docs/src/demos/Examples/Basic/tests/clearContent.spec.js
Normal file
@@ -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('<p>Example Text</p>')
|
||||
|
||||
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('<p>Example Text</p>')
|
||||
|
||||
editor.commands.clearContent()
|
||||
|
||||
expect(editor.getHTML()).to.be.eq('<p></p>')
|
||||
})
|
||||
})
|
||||
})
|
||||
25
docs/src/demos/Examples/Basic/tests/insertHTML.spec.js
Normal file
25
docs/src/demos/Examples/Basic/tests/insertHTML.spec.js
Normal file
@@ -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('<p>Example Text</p>')
|
||||
|
||||
const command = editor.commands.insertHTML('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('appends the content when using the insertHTML command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Example Text</p>')
|
||||
|
||||
editor.commands.insertHTML('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(editor.getHTML()).to.be.eq('<p>Example Text</p><p>Cindy Lauper</p>')
|
||||
})
|
||||
})
|
||||
})
|
||||
21
docs/src/demos/Examples/Basic/tests/setContent.spec.js
Normal file
21
docs/src/demos/Examples/Basic/tests/setContent.spec.js
Normal file
@@ -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('<p>Example Text</p>')
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
})
|
||||
|
||||
it('clears the content when using the setContent command', () => {
|
||||
cy.get('.ProseMirror').then(([{ editor }]) => {
|
||||
editor.commands.setContent('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(editor.getHTML()).to.be.eq('<p>Cindy Lauper</p>')
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,36 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { Editor } from '@tiptap/core'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
|
||||
describe('clearContent', () => {
|
||||
it('returns true when clearing the content', () => {
|
||||
const editor = new Editor({
|
||||
extensions: [
|
||||
Document,
|
||||
Paragraph,
|
||||
Text,
|
||||
],
|
||||
})
|
||||
|
||||
const command = editor.commands.clearContent()
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
|
||||
it('clears the content when using clearContent', () => {
|
||||
const editor = new Editor({
|
||||
extensions: [
|
||||
Document,
|
||||
Paragraph,
|
||||
Text,
|
||||
],
|
||||
})
|
||||
|
||||
editor.commands.clearContent()
|
||||
|
||||
expect(editor.getHTML()).to.eq('<p></p>')
|
||||
})
|
||||
})
|
||||
@@ -1,36 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { Editor } from '@tiptap/core'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
|
||||
describe('insertHTML', () => {
|
||||
it('returns true when inserting HTML', () => {
|
||||
const editor = new Editor({
|
||||
extensions: [
|
||||
Document,
|
||||
Paragraph,
|
||||
Text,
|
||||
],
|
||||
})
|
||||
|
||||
const command = editor.commands.insertHTML('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
|
||||
it('appends the content when using insertHTML', () => {
|
||||
const editor = new Editor({
|
||||
extensions: [
|
||||
Document,
|
||||
Paragraph,
|
||||
Text,
|
||||
],
|
||||
})
|
||||
|
||||
editor.commands.insertHTML('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(editor.getHTML()).to.eq('<p></p><p>Cindy Lauper</p>')
|
||||
})
|
||||
})
|
||||
@@ -1,36 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import { Editor } from '@tiptap/core'
|
||||
import Document from '@tiptap/extension-document'
|
||||
import Paragraph from '@tiptap/extension-paragraph'
|
||||
import Text from '@tiptap/extension-text'
|
||||
|
||||
describe('setContent', () => {
|
||||
it('returns true when setting the content', () => {
|
||||
const editor = new Editor({
|
||||
extensions: [
|
||||
Document,
|
||||
Paragraph,
|
||||
Text,
|
||||
],
|
||||
})
|
||||
|
||||
const command = editor.commands.setContent('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(command).to.be.eq(true)
|
||||
})
|
||||
|
||||
it('replaces the content when using setContent', () => {
|
||||
const editor = new Editor({
|
||||
extensions: [
|
||||
Document,
|
||||
Paragraph,
|
||||
Text,
|
||||
],
|
||||
})
|
||||
|
||||
editor.commands.setContent('<p>Cindy Lauper</p>')
|
||||
|
||||
expect(editor.getHTML()).to.eq('<p>Cindy Lauper</p>')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user