diff --git a/test/unit/modules/vdom/create-element.spec.js b/test/unit/modules/vdom/create-element.spec.js index 16a5e4a8a7c..68773850be7 100644 --- a/test/unit/modules/vdom/create-element.spec.js +++ b/test/unit/modules/vdom/create-element.spec.js @@ -253,4 +253,24 @@ describe('create-element', () => { expect(vm.$el.querySelector('input').value).toBe('b') }).then(done) }) + + // #7786 + it('creates element with vnode reference in :class or :style', () => { + const vm = new Vue({ + components: { + foo: { + render (h) { + return h('div', { + class: { + 'has-vnode': this.$vnode + } + }, 'foo') + } + } + }, + render: h => h('foo') + }).$mount() + expect(vm.$el.innerHTML).toContain('foo') + expect(vm.$el.classList.contains('has-vnode')).toBe(true) + }) })