Skip to content

Commit 745f8a9

Browse files
committed
add scoped slots render function usage test
1 parent 7f36f99 commit 745f8a9

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/unit/features/component/component-scoped-slot.spec.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,37 @@ describe('Component scoped slot', () => {
249249
}).$mount()
250250
expect(`\`key\` does not work on <slot>`).toHaveBeenWarned()
251251
})
252+
253+
it('render function usage', done => {
254+
const vm = new Vue({
255+
render (h) {
256+
return h('test', {
257+
ref: 'test',
258+
scopedSlots: {
259+
item: props => h('span', props.text)
260+
}
261+
})
262+
},
263+
components: {
264+
test: {
265+
data () {
266+
return { msg: 'hello' }
267+
},
268+
render (h) {
269+
return h('div', [
270+
this.$scopedSlots.item({
271+
text: this.msg
272+
})
273+
])
274+
}
275+
}
276+
}
277+
}).$mount()
278+
279+
expect(vm.$el.innerHTML).toBe('<span>hello</span>')
280+
vm.$refs.test.msg = 'world'
281+
waitForUpdate(() => {
282+
expect(vm.$el.innerHTML).toBe('<span>world</span>')
283+
}).then(done)
284+
})
252285
})

0 commit comments

Comments
 (0)