返回 slidev
drag.test.ts
根目录 / packages / slidev / node / syntax / drag.test.ts
1 import type MagicString from 'magic-string-stack'
2 import MarkdownExit from 'markdown-exit'
3 import { expect, it } from 'vitest'
4 import MarkdownItVDrag from './drag'
5
6 it('v-drag component', async () => {
7 const md = MarkdownExit({ html: true })
8 const map = new Map<string, MagicString>()
9 md.use(MarkdownItVDrag, map)
10
11 const result = await md.renderAsync('<v-drag>Content</v-drag>', { id: 'test' })
12
13 expect(result).toMatchInlineSnapshot(`
14 "<p><v-drag :markdownSource="[0,1,0]">Content</v-drag></p>
15 "
16 `)
17 })
18
19 it('v-drag directive', async () => {
20 const md = MarkdownExit({ html: true })
21 const map = new Map<string, MagicString>()
22 md.use(MarkdownItVDrag, map)
23
24 const result = await md.renderAsync('<div v-drag>Content</div>', { id: 'test' })
25
26 expect(result).toMatchInlineSnapshot(`"<div v-drag :markdownSource="[0,1,5]">Content</div>"`)
27 })
28
28 lines TYPESCRIPT