`,
components: { Foo }
}).$mount()
expect(vm.$el.innerHTML).toBe('hi')
})
it('should work when used as named slot and returning array', () => {
const Foo = {
template: `
`
}
const Bar = {
functional: true,
render: h => ([
h('div', 'one'),
h('div', 'two'),
h(Baz)
])
}
const Baz = {
functional: true,
render: h => h('div', 'three')
}
const vm = new Vue({
template: ``,
components: { Foo, Bar }
}).$mount()
expect(vm.$el.innerHTML).toBe('
one
two
three
')
})
it('should apply namespace when returning arrays', () => {
const Child = {
functional: true,
render: h => ([h('foo'), h('bar')])
}
const vm = new Vue({
template: ``,
components: { Child }
}).$mount()
expect(vm.$el.childNodes[0].namespaceURI).toContain('svg')
expect(vm.$el.childNodes[1].namespaceURI).toContain('svg')
})
it('should work with render fns compiled from template', done => {
// code generated via vue-template-es2015-compiler
var render = function (_h, _vm) {
var _c = _vm._c
return _c(
'div',
[
_c('h2', { staticClass: 'red' }, [_vm._v(_vm._s(_vm.props.msg))]),
_vm._t('default'),
_vm._t('slot2'),
_vm._t('scoped', null, { msg: _vm.props.msg }),
_vm._m(0),
_c('div', { staticClass: 'clickable', on: { click: _vm.parent.fn }}, [
_vm._v('click me')
])
],
2
)
}
var staticRenderFns = [
function (_h, _vm) {
var _c = _vm._c
return _c('div', [_vm._v('Some '), _c('span', [_vm._v('text')])])
}
]
const child = {
functional: true,
_compiled: true,
render,
staticRenderFns
}
const parent = new Vue({
components: {
child
},
data: {
msg: 'hello'
},
template: `