fix(compiler-dom): stringifyStatic should remove attribute bindings with null value (#3477)
fix #3475
This commit is contained in:
@@ -294,4 +294,26 @@ describe('stringify static html', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('should remove attribute for `null`', () => {
|
||||
const { ast } = compileWithStringify(
|
||||
`<div>${repeat(
|
||||
`<span :title="null"></span>`,
|
||||
StringifyThresholds.ELEMENT_WITH_BINDING_COUNT
|
||||
)}</div>`
|
||||
)
|
||||
expect(ast.hoists[0]).toMatchObject({
|
||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||
callee: CREATE_STATIC,
|
||||
arguments: [
|
||||
JSON.stringify(
|
||||
`${repeat(
|
||||
`<span></span>`,
|
||||
StringifyThresholds.ELEMENT_WITH_BINDING_COUNT
|
||||
)}`
|
||||
),
|
||||
'5'
|
||||
]
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user