Fix keys, normalize holes (#2452)

* Fix #2434

* Treat holes as unkeyed, normalize boolean/null/undefined

This brings a lot better consistency with that API, even though it's
slightly breaking. (I had to update a bunch of tests to correspond with
it.)

* Fill in PR number [skip ci]
This commit is contained in:
Isiah Meadows 2019-07-03 17:05:44 -04:00 committed by GitHub
parent 86d64e213f
commit 6c562d2b9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 200 additions and 182 deletions

View file

@ -110,7 +110,7 @@ o.spec("component", function() {
visible = false
render(root, [{tag: component}])
o(root.firstChild.nodeValue).equals("")
o(root.childNodes.length).equals(0)
})
o("updates root from null to null", function() {
var component = createComponent({
@ -218,7 +218,7 @@ o.spec("component", function() {
o(root.firstChild.nodeType).equals(3)
o(root.firstChild.nodeValue).equals("0")
})
o("can return boolean", function() {
o("can return `true`", function() {
var component = createComponent({
view: function() {
return true
@ -226,10 +226,9 @@ o.spec("component", function() {
})
render(root, [{tag: component}])
o(root.firstChild.nodeType).equals(3)
o(root.firstChild.nodeValue).equals("true")
o(root.childNodes.length).equals(0)
})
o("can return falsy boolean", function() {
o("can return `false`", function() {
var component = createComponent({
view: function() {
return false
@ -237,8 +236,7 @@ o.spec("component", function() {
})
render(root, [{tag: component}])
o(root.firstChild.nodeType).equals(3)
o(root.firstChild.nodeValue).equals("")
o(root.childNodes.length).equals(0)
})
o("can return null", function() {
var component = createComponent({
@ -293,8 +291,7 @@ o.spec("component", function() {
})
render(root, [{tag: component}])
o(root.firstChild.nodeType).equals(3)
o(root.firstChild.nodeValue).equals("")
o(root.childNodes.length).equals(0)
try {
render(root, [{tag: component}])