Skip to content

Commit 561bb46

Browse files
committed
test functional auto props with render fn
1 parent a796529 commit 561bb46

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

test/unit/features/options/functional.spec.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,25 @@ describe('Options functional', () => {
2323
})
2424

2525
it('should expose all props when not declared', done => {
26+
const fn = {
27+
functional: true,
28+
render (h, { props }) {
29+
return h('div', `${props.msg} ${props.kebabMsg}`)
30+
}
31+
}
32+
2633
const vm = new Vue({
2734
data: { test: 'foo' },
28-
template: '<div><wrap :msg="test" kebab-msg="bar"></wrap></div>',
29-
components: {
30-
wrap: {
31-
functional: true,
32-
render (h, { props }) {
33-
return h('div', `${props.msg} ${props.kebabMsg}`)
34-
}
35-
}
35+
render (h) {
36+
return h('div', [
37+
h(fn, {
38+
props: { msg: this.test },
39+
attrs: { 'kebab-msg': 'bar' }
40+
})
41+
])
3642
}
3743
}).$mount()
44+
3845
expect(vm.$el.innerHTML).toBe('<div>foo bar</div>')
3946
vm.test = 'qux'
4047
waitForUpdate(() => {

0 commit comments

Comments
 (0)