fix(compiler-core): handle base-transition

This commit is contained in:
Evan You
2019-11-29 12:02:31 -05:00
parent 52239d137c
commit 52134a88d0
4 changed files with 31 additions and 8 deletions

View File

@@ -10,7 +10,8 @@ import {
PORTAL,
RESOLVE_DYNAMIC_COMPONENT,
SUSPENSE,
KEEP_ALIVE
KEEP_ALIVE,
BASE_TRANSITION
} from '../../src/runtimeHelpers'
import {
CallExpression,
@@ -356,6 +357,30 @@ describe('compiler: element transform', () => {
assert(`KeepAlive`)
})
test('should handle <BaseTransition>', () => {
function assert(tag: string) {
const { root, node } = parseWithElementTransform(
`<${tag}><span /></${tag}>`
)
expect(root.components.length).toBe(0)
expect(root.helpers).toContain(BASE_TRANSITION)
expect(node.callee).toBe(CREATE_VNODE)
expect(node.arguments).toMatchObject([
BASE_TRANSITION,
`null`,
createObjectMatcher({
default: {
type: NodeTypes.JS_FUNCTION_EXPRESSION
},
_compiled: `[true]`
})
])
}
assert(`base-transition`)
assert(`BaseTransition`)
})
test('error on v-bind with no argument', () => {
const onError = jest.fn()
parseWithElementTransform(`<div v-bind/>`, { onError })