tiptap/tests/cypress/integration/html/generateHTML.spec.ts
Dominik 8c6751f0c6
add precommit hook for linting and automatic eslint fixes + update eslint packages (#2862)
* chore: add precommit hook for eslint fixes, fix linting issues
* chore: add eslint import sort plugin
2022-06-08 14:10:25 +02:00

30 lines
657 B
TypeScript

/// <reference types="cypress" />
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import { generateHTML } from '@tiptap/html'
describe('generateHTML', () => {
it('generate HTML from JSON without an editor instance', () => {
const json = {
type: 'doc',
content: [{
type: 'paragraph',
content: [{
type: 'text',
text: 'Example Text',
}],
}],
}
const html = generateHTML(json, [
Document,
Paragraph,
Text,
])
expect(html).to.eq('<p>Example Text</p>')
})
})