fix(compiler-core): assest id (#190)

* fix(compile-core): asset id

* test(compile-core): asset id
This commit is contained in:
月迷津渡
2019-10-11 01:55:26 +08:00
committed by Evan You
parent 4ca32c537d
commit f71d252ffe
3 changed files with 10 additions and 4 deletions

View File

@@ -89,7 +89,7 @@ describe('compiler: codegen', () => {
test('assets', () => {
const root = createRoot({
components: [`Foo`, `bar-baz`],
components: [`Foo`, `bar-baz`, `barbaz`],
directives: [`my_dir`]
})
const { code } = generate(root, { mode: 'function' })
@@ -97,10 +97,15 @@ describe('compiler: codegen', () => {
`const _component_Foo = _${helperNameMap[RESOLVE_COMPONENT]}("Foo")\n`
)
expect(code).toMatch(
`const _component_barbaz = _${
`const _component_bar_baz = _${
helperNameMap[RESOLVE_COMPONENT]
}("bar-baz")\n`
)
expect(code).toMatch(
`const _component_barbaz = _${
helperNameMap[RESOLVE_COMPONENT]
}("barbaz")\n`
)
expect(code).toMatch(
`const _directive_my_dir = _${
helperNameMap[RESOLVE_DIRECTIVE]