-
-
Notifications
You must be signed in to change notification settings - Fork 335
/
element-plus.test.ts
31 lines (28 loc) 路 1.01 KB
/
element-plus.test.ts
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
import { describe, expect, it } from 'vitest'
import { ElementPlusResolver } from '../../src/resolvers'
import { Context } from '../../src/core/context'
describe('Element Plus Resolver', () => {
it('components and directives should be transformed', async () => {
const code = `
(_ctx, _cache) => {
const _component_el_button = _resolveComponent("el-button")
const _component_el_icon_apple = _resolveComponent("el-icon-apple")
const _directive_loading = _resolveDirective("loading")
return (_openBlock(), _createElementBlock(_Fragment, null, [
_createVNode(_component_el_button),
_createVNode(_component_el_icon_apple),
_withDirectives(_createElementVNode("div", null, null, 512 /* NEED_PATCH */), [
[_directive_loading, true]
])
], 64 /* STABLE_FRAGMENT */))
}
`
const ctx = new Context({
resolvers: [ElementPlusResolver({})],
transformer: 'vue3',
directives: true,
})
ctx.sourcemap = false
expect(await ctx.transform(code, '')).toMatchSnapshot()
})
})