RSpec.describe TiptapService do
describe '.to_html' do
let(:json) do
{
type: 'doc',
content: [
{
type: 'header',
content: [
{
type: 'headerColumn',
content: [{ type: 'text', text: 'Left' }]
},
{
type: 'headerColumn',
content: [{ type: 'text', text: 'Right' }]
}
]
},
{
type: 'title',
content: [{ type: 'text', text: 'Title' }]
},
{
type: 'paragraph',
attrs: { textAlign: 'right' },
content: [
{
type: 'text',
text: 'Hello world!'
}
]
},
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'Bonjour ',
marks: [{ type: 'italic' }, { type: 'strike' }]
},
{
type: 'mention',
attrs: { id: 'name' },
marks: [{ type: 'bold' }, { type: 'underline' }]
},
{
type: 'text',
text: ' '
},
{
type: 'text',
text: '!',
marks: [{ type: 'highlight' }]
}
]
},
{
type: 'heading',
attrs: { level: 1 },
content: [{ type: 'text', text: 'Heading 1' }]
},
{
type: 'heading',
attrs: { level: 2, textAlign: 'center' },
content: [{ type: 'text', text: 'Heading 2' }]
},
{
type: 'heading',
attrs: { level: 3 },
content: [{ type: 'text', text: 'Heading 3' }]
},
{
type: 'bulletList',
content: [
{
type: 'listItem',
content: [
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'Item 1'
}
]
}
]
},
{
type: 'listItem',
content: [
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'Item 2'
}
]
}
]
}
]
},
{
type: 'orderedList',
content: [
{
type: 'listItem',
content: [
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'Item 1'
}
]
}
]
},
{
type: 'listItem',
content: [
{
type: 'paragraph',
content: [
{
type: 'text',
text: 'Item 2'
}
]
}
]
}
]
},
{
type: 'footer',
content: [{ type: 'text', text: 'Footer' }]
}
]
}
end
let(:tags) { { 'name' => 'Paul' } }
let(:html) do
[
'
Hello world!
', 'Bonjour Paul !
Item 1
Item 2
Item 1
Item 2