mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-24 01:17:50 +08:00
30 lines
662 B
TypeScript
30 lines
662 B
TypeScript
/// <reference types="cypress" />
|
|
|
|
import { generateHTML } from '@tiptap/html'
|
|
import Document from '@tiptap/extension-document'
|
|
import Paragraph from '@tiptap/extension-paragraph'
|
|
import Text from '@tiptap/extension-text'
|
|
|
|
describe('generateHTML', () => {
|
|
it('generate HTML from JSON without an editor instance', () => {
|
|
const json = {
|
|
type: 'document',
|
|
content: [{
|
|
type: 'paragraph',
|
|
content: [{
|
|
type: 'text',
|
|
text: 'Example Text',
|
|
}],
|
|
}],
|
|
}
|
|
|
|
const html = generateHTML(json, [
|
|
Document,
|
|
Paragraph,
|
|
Text,
|
|
])
|
|
|
|
expect(html).to.eq('<p>Example Text</p>')
|
|
})
|
|
})
|