diff --git a/index.js b/index.js index de6fc07..2c707c6 100644 --- a/index.js +++ b/index.js @@ -117,8 +117,8 @@ module.exports = function (h, opts) { ) } } else if (s === VAR && p[1] === TEXT) { - if (p[2] === undefined || p[2] === null) p[2] = '' - else if (!p[2]) p[2] = concat('', p[2]) + if (p[2] === undefined || p[2] === null || p[2] === false) p[2] = '' + else if (!p[2] || p[2] === true) p[2] = concat('', p[2]) if (Array.isArray(p[2][0])) { cur[2].push.apply(cur[2], p[2]) } else { diff --git a/test/types.js b/test/types.js index 13f6c21..f884025 100644 --- a/test/types.js +++ b/test/types.js @@ -15,9 +15,21 @@ test('null value (empty)', function (t) { t.end() }) -test('boolean value', function (t) { +test('string value (empty)', function (t) { + var tree = hx`
${''}
` + t.equal(vdom.create(tree).toString(), '
') + t.end() +}) + +test('boolean value (empty)', function (t) { var tree = hx`
${false}
` - t.equal(vdom.create(tree).toString(), '
false
') + t.equal(vdom.create(tree).toString(), '
') + t.end() +}) + +test('boolean value', function (t) { + var tree = hx`
${true}
` + t.equal(vdom.create(tree).toString(), '
true
') t.end() }) @@ -26,3 +38,9 @@ test('numeric value', function (t) { t.equal(vdom.create(tree).toString(), '
555
') t.end() }) + +test('numeric value (zero)', function (t) { + var tree = hx`
${0}
` + t.equal(vdom.create(tree).toString(), '
0
') + t.end() +})