Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test(component-slot): new child vnode gets destroyed instead of old one
fix #8337
  • Loading branch information
Hiroki Osame committed Aug 9, 2018
commit 464e39b5e4808d6f3f1d0cbf8cad0cbbf453f258
43 changes: 43 additions & 0 deletions test/unit/features/component/component-slot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -886,4 +886,47 @@ describe('Component slot', () => {
expect(vm.$el.textContent).toBe('foo')
}).then(done)
})

// #8337
it('should not destroy the new child vm', done => {
const Parent = {
render (h) {
return h(this.API.tag, this.$slots.default)
},
data () {
return { API: { tag: 'p' }}
},
provide () {
return { key: this.API }
}
}

const Child = {
template: '<div></div>',
inject: { wrapper: 'key' },
created () {
this.wrapper.tag = 'div'
}
}

const vm = new Vue({
components: {
Child,
Parent
},
template: `
<parent>
<div>
<child ref="child" />
</div>
</parent>
`
}).$mount()

expect(vm.$refs.child).toBeDefined()

waitForUpdate(() => {
expect(vm.$refs.child).toBeDefined()
}).then(done)
})
})