blob: 08d5cb0a9aafe3351aaa15a2656c5872585b70d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import markdownit from './../markdownit'
describe('markdownit', () => {
it('renders task lists', () => {
const rendered = markdownit.render('* [ ] task\n* not a task')
expect(rendered).toBe(stripIndent(`
<ul class="contains-task-list">
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox"> task</li>
</ul>
<ul>
<li>not a task</li>
</ul>
`))
})
it('renders bullet and task lists separately', () => {
const rendered = markdownit.render('* not a task\n* [ ] task')
expect(rendered).toBe(stripIndent(`
<ul>
<li>not a task</li>
</ul>
<ul class="contains-task-list">
<li class="task-list-item"><input class="task-list-item-checkbox" disabled="" type="checkbox"> task</li>
</ul>
`))
})
})
function stripIndent(content) {
return content.replace(/\t/g, '').replace('\n','')
}
|