Browse Source

test functional auto props with render fn

dev
Evan You 8 years ago
parent
commit
561bb467ba
  1. 23
      test/unit/features/options/functional.spec.js

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

@ -23,18 +23,25 @@ describe('Options functional', () => {
})
it('should expose all props when not declared', done => {
const fn = {
functional: true,
render (h, { props }) {
return h('div', `${props.msg} ${props.kebabMsg}`)
}
}
const vm = new Vue({
data: { test: 'foo' },
template: '<div><wrap :msg="test" kebab-msg="bar"></wrap></div>',
components: {
wrap: {
functional: true,
render (h, { props }) {
return h('div', `${props.msg} ${props.kebabMsg}`)
}
}
render (h) {
return h('div', [
h(fn, {
props: { msg: this.test },
attrs: { 'kebab-msg': 'bar' }
})
])
}
}).$mount()
expect(vm.$el.innerHTML).toBe('<div>foo bar</div>')
vm.test = 'qux'
waitForUpdate(() => {

Loading…
Cancel
Save