* De-servicify router (mostly) Still uses the redraw service, but it no longer has an intermediate service of its own. Also, did a *lot* of test deduplication in this. About 30-40% of the router service tests were already tested on the main router API instance itself. Bundle size decreased from 9560 to 9548 bytes min+gzip. * Merge `m.mount` + `m.redraw`, update router Simplifies the router and redraw mechanism, and makes it much easier to keep predictable. Bundle size down to 9433 bytes min+gzip, docs updated accordingly. * Make `mithril/render` just return the `m.render` function directly. * Deservicify `m.render`, revise `m.route` - You now have to use `mithril/render/render` directly if you want an implicit redraw function. (This will likely be going away in v3.) - Revise `m.route` to only `key` components * Add `redraw` to `m.render`, deservicify requests * Test error logging * Update docs + changelog [skip ci]
34 lines
836 B
JavaScript
34 lines
836 B
JavaScript
"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)
|
|
|
|
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")
|
|
})
|
|
})
|
|
})
|