fix(compiler-dom): bail static stringfication on non-attr bindings

fix #1128
This commit is contained in:
Evan You
2020-05-07 10:32:13 -04:00
parent 2f69167e88
commit 304ab8c99b
3 changed files with 106 additions and 26 deletions

View File

@@ -168,4 +168,29 @@ describe('stringify static html', () => {
type: NodeTypes.VNODE_CALL
})
})
// #1128
test('should bail on non attribute bindings', () => {
const { ast } = compileWithStringify(
`<div><div><input indeterminate>${repeat(
`<span class="foo">foo</span>`,
StringifyThresholds.ELEMENT_WITH_BINDING_COUNT
)}</div></div>`
)
expect(ast.hoists.length).toBe(1)
expect(ast.hoists[0]).toMatchObject({
type: NodeTypes.VNODE_CALL // not CALL_EXPRESSION
})
const { ast: ast2 } = compileWithStringify(
`<div><div><input :indeterminate="true">${repeat(
`<span class="foo">foo</span>`,
StringifyThresholds.ELEMENT_WITH_BINDING_COUNT
)}</div></div>`
)
expect(ast2.hoists.length).toBe(1)
expect(ast2.hoists[0]).toMatchObject({
type: NodeTypes.VNODE_CALL // not CALL_EXPRESSION
})
})
})