* 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]
24 lines
639 B
JavaScript
24 lines
639 B
JavaScript
"use strict"
|
|
|
|
var o = require("../../ospec/ospec")
|
|
var Vnode = require("../../render/vnode")
|
|
|
|
o.spec("normalizeChildren", function() {
|
|
o("normalizes arrays into fragments", function() {
|
|
var children = Vnode.normalizeChildren([[]])
|
|
|
|
o(children[0].tag).equals("[")
|
|
o(children[0].children.length).equals(0)
|
|
})
|
|
o("normalizes strings into text nodes", function() {
|
|
var children = Vnode.normalizeChildren(["a"])
|
|
|
|
o(children[0].tag).equals("#")
|
|
o(children[0].children).equals("a")
|
|
})
|
|
o("normalizes `false` values into `null`s", function() {
|
|
var children = Vnode.normalizeChildren([false])
|
|
|
|
o(children[0]).equals(null)
|
|
})
|
|
})
|