forked from vuejs/vuepress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnippet.spec.js
57 lines (48 loc) · 1.98 KB
/
snippet.spec.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { getFragment } from '@vuepress/test-utils'
import { Md } from './util'
import snippet from '../lib/snippet.js'
import highlightLines from '../lib/highlightLines.js'
const md = Md().use(snippet)
const mdH = Md().use(highlightLines).use(snippet)
describe('snippet', () => {
test('import snippet', () => {
const input = getFragment(__dirname, 'code-snippet.md')
const output = md.render(input)
expect(output).toMatchSnapshot()
})
test('import snippet with highlight single line', () => {
const input = getFragment(__dirname, 'code-snippet-highlightLines-single.md')
const output = mdH.render(input)
expect(output).toMatchSnapshot()
})
test('import snippet with highlight multiple lines', () => {
const input = getFragment(__dirname, 'code-snippet-highlightLines-multiple.md')
const output = mdH.render(input)
expect(output).toMatchSnapshot()
})
test('import snippets when the file has a space in the file path', () => {
const input = getFragment(__dirname, 'code-snippet-with-space-in-path.md')
const output = mdH.render(input)
expect(output).toMatchSnapshot()
})
test('import snippet with region', () => {
const input = getFragment(__dirname, 'code-snippet-with-region.md')
const output = md.render(input)
expect(output).toMatchSnapshot()
})
test('import snippet with region and highlight', () => {
const input = getFragment(__dirname, 'code-snippet-with-region-and-highlight.md')
const output = md.render(input)
expect(output).toMatchSnapshot()
})
test('import snippet with region and single line highlight > 10', () => {
const input = getFragment(__dirname, 'code-snippet-with-region-and-single-highlight.md')
const output = md.render(input)
expect(output).toMatchSnapshot()
})
test('import snippet with indented region', () => {
const input = getFragment(__dirname, 'code-snippet-with-indented-region.md')
const output = md.render(input)
expect(output).toMatchSnapshot()
})
})