|
|
@@ -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(() => {
|