tests: Update tests for false -> "" behavior

This commit is contained in:
Pat Cavit 2017-01-05 23:07:47 -08:00
parent 6170573c29
commit 9f32267259
4 changed files with 20 additions and 8 deletions

View file

@ -229,7 +229,7 @@ o.spec("hyperscript", function() {
o("handles falsy boolean single child", function() {
var vnode = m("div", {}, [false])
o(vnode.text).equals(false)
o(vnode.text).equals("")
})
o("handles null single child", function() {
var vnode = m("div", {}, [null])
@ -261,7 +261,7 @@ o.spec("hyperscript", function() {
var vnode = m("div", {}, [false, true])
o(vnode.children[0].tag).equals("#")
o(vnode.children[0].children).equals(false)
o(vnode.children[0].children).equals("")
o(vnode.children[1].tag).equals("#")
o(vnode.children[1].children).equals(true)
})
@ -353,10 +353,16 @@ o.spec("hyperscript", function() {
o(vnode.text).equals(true)
})
o("handles attr and single falsy boolean text child", function() {
var vnode = m("div", {a: "b"}, [0])
o(vnode.attrs.a).equals("b")
o(vnode.text).equals(0)
})
o("handles attr and single false boolean text child", function() {
var vnode = m("div", {a: "b"}, [false])
o(vnode.attrs.a).equals("b")
o(vnode.text).equals(false)
o(vnode.text).equals("")
})
o("handles attr and single text child unwrapped", function() {
var vnode = m("div", {a: "b"}, "c")