add tests for a few core commands

This commit is contained in:
Hans Pagel
2020-11-23 16:13:06 +01:00
parent fa73035aa4
commit 5a1f8d7b6a
3 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
/// <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.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>')
})
})