Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed May 16, 2023
1 parent 97005cf commit 2b3c393
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/features/parser-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@ export const testMarkdownParser = () => {
expect(props.highlights).toEqual([4, 5, 6, 7])
})

test('Keep meta from fenced code block 2', async () => {
const parsed = await $fetch('/api/parse', {
method: 'POST',
body: {
id: 'content:index.md',
content: [
'```ts[file.ts] {4-6,7} other code block info',
'let code = undefined;',
'return code;',
'```'
].join('\n')
}
})

expect(parsed).toHaveProperty('body')
expect(parsed.body).toHaveProperty('children[0].tag', 'code')
expect(parsed.body).toHaveProperty('children[0].props')
const props = parsed.body.children[0].props
expect(props).toHaveProperty('meta')
expect(props.meta).toBe('other code block info')
expect(props.language).toBe('ts')
expect(props.filename).toBe('file.ts')
expect(props.highlights).toEqual([4, 5, 6, 7])
})

test('comment', async () => {
const parsed = await $fetch('/api/parse', {
method: 'POST',
Expand Down

0 comments on commit 2b3c393

Please sign in to comment.