Skip to content

Commit ec49505

Browse files
committed
test: binding component spacing
1 parent e22f0c0 commit ec49505

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

test/markdown/binding.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { describe, expect, it } from 'vitest'
2+
import { parseMarkdown, stringifyMarkdown } from '../utils/parser'
3+
4+
describe('Markdown Binding', () => {
5+
const markdowns = [
6+
'{{ foo }}',
7+
'{{ foo || \'Foo\' }}',
8+
'{{ foo || \'Foo\' }}, bar',
9+
'{{ foo || \'Foo\' }}. bar',
10+
`Hello{{ name }}`,
11+
`Hello {{ name }}`,
12+
`Hello{{ name }},`,
13+
`Hello {{ name }},`,
14+
`Hello {{ name }} ,`
15+
]
16+
17+
for (const markdown of markdowns) {
18+
it(markdown, async () => {
19+
const ast = await parseMarkdown(markdown)
20+
const regenerated = await stringifyMarkdown(ast.body)
21+
22+
expect(regenerated?.trim()).toEqual(markdown)
23+
})
24+
}
25+
})

test/markdown/inline-component-spacing.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,6 @@ it('Add space before :br', async () => {
1919
expect(output).toBe(`:br\nWorld\n`)
2020
})
2121

22-
it('Do not change spacings of binding elements', async () => {
23-
const inputs = [
24-
`Hello{{ name }}`,
25-
`Hello {{ name }}`,
26-
`Hello{{ name }},`,
27-
`Hello {{ name }},`,
28-
`Hello {{ name }} ,`
29-
]
30-
31-
for (const input of inputs) {
32-
const { body } = await parseMarkdown(input)
33-
const output = await stringifyMarkdown(body)
34-
35-
expect(output).toBe(input + '\n')
36-
}
37-
})
38-
3922
it('Ensure spacing between inline components', async () => {
4023
const input = `This is a :test :for components :spacing`
4124

0 commit comments

Comments
 (0)