fix(compiler-core): prevent generating invalid code for v-bind with empty expression (#1720)
This commit is contained in:
@@ -83,7 +83,8 @@ describe('compiler: transform v-bind', () => {
|
||||
|
||||
test('should error if no expression', () => {
|
||||
const onError = jest.fn()
|
||||
parseWithVBind(`<div v-bind:arg />`, { onError })
|
||||
const node = parseWithVBind(`<div v-bind:arg />`, { onError })
|
||||
const props = (node.codegenNode as VNodeCall).props as ObjectExpression
|
||||
expect(onError.mock.calls[0][0]).toMatchObject({
|
||||
code: ErrorCodes.X_V_BIND_NO_EXPRESSION,
|
||||
loc: {
|
||||
@@ -97,6 +98,16 @@ describe('compiler: transform v-bind', () => {
|
||||
}
|
||||
}
|
||||
})
|
||||
expect(props.properties[0]).toMatchObject({
|
||||
key: {
|
||||
content: `arg`,
|
||||
isStatic: true
|
||||
},
|
||||
value: {
|
||||
content: ``,
|
||||
isStatic: true
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
test('.camel modifier', () => {
|
||||
|
||||
Reference in New Issue
Block a user