fix: dynamic component fallback to native element

fix #870
This commit is contained in:
Evan You
2020-03-23 14:47:04 -04:00
parent 1b2149dbb2
commit f529dbde23
7 changed files with 80 additions and 34 deletions

View File

@@ -798,9 +798,18 @@ describe('compiler: element transform', () => {
describe('dynamic component', () => {
test('static binding', () => {
const { node, root } = parseWithBind(`<component is="foo" />`)
expect(root.helpers).not.toContain(RESOLVE_DYNAMIC_COMPONENT)
expect(root.helpers).toContain(RESOLVE_DYNAMIC_COMPONENT)
expect(node).toMatchObject({
tag: '_component_foo'
tag: {
callee: RESOLVE_DYNAMIC_COMPONENT,
arguments: [
{
type: NodeTypes.SIMPLE_EXPRESSION,
content: 'foo',
isStatic: true
}
]
}
})
})
@@ -813,7 +822,8 @@ describe('compiler: element transform', () => {
arguments: [
{
type: NodeTypes.SIMPLE_EXPRESSION,
content: 'foo'
content: 'foo',
isStatic: false
}
]
}