fix(runtime-test): output empty attrs without value in seralized output

This commit is contained in:
Evan You
2019-12-17 11:50:10 -05:00
parent 31ca7858bb
commit 3d16c0ea5a
2 changed files with 9 additions and 4 deletions

View File

@@ -40,7 +40,11 @@ function serializeElement(
const props = Object.keys(node.props)
.map(key => {
const value = node.props[key]
return isOn(key) || value == null ? `` : `${key}=${JSON.stringify(value)}`
return isOn(key) || value == null
? ``
: value === ``
? key
: `${key}=${JSON.stringify(value)}`
})
.filter(Boolean)
.join(' ')