Do not normalise component children on ingestion (#2155)
* Do not normalise component children on ingestion * Don't normalise vnode children * Component hyperscript tests: children aren't normalised * test, not text * Update change log: #2155 & #2064
This commit is contained in:
parent
0f498e0aec
commit
1579fe8430
6 changed files with 59 additions and 15 deletions
34
render/tests/test-normalizeComponentChildren.js
Normal file
34
render/tests/test-normalizeComponentChildren.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var m = require("../../render/hyperscript")
|
||||
var domMock = require("../../test-utils/domMock")
|
||||
var vdom = require("../../render/render")
|
||||
|
||||
o.spec("component children", function () {
|
||||
var $window = domMock()
|
||||
var root = $window.document.createElement("div")
|
||||
var render = vdom($window).render
|
||||
|
||||
o.spec("component children", function () {
|
||||
var component = {
|
||||
view: function (vnode) {
|
||||
return vnode.children
|
||||
}
|
||||
}
|
||||
|
||||
var vnode = m(component, "a")
|
||||
|
||||
render(root, vnode)
|
||||
|
||||
o("are not normalized on ingestion", function () {
|
||||
o(vnode.children[0]).equals("a")
|
||||
})
|
||||
|
||||
o("are normalized upon view interpolation", function () {
|
||||
o(vnode.instance.children.length).equals(1)
|
||||
o(vnode.instance.children[0].tag).equals("#")
|
||||
o(vnode.instance.children[0].children).equals("a")
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue