fix(ssr): should set ref on hydration

This commit is contained in:
Evan You
2020-05-21 17:37:23 -04:00
parent 5a3b44caf7
commit 0a7932c6b3
3 changed files with 135 additions and 107 deletions

View File

@@ -124,6 +124,15 @@ describe('SSR hydration', () => {
expect(vnode.el.innerHTML).toBe(`<span>bar</span><span class="bar"></span>`)
})
test('element with ref', () => {
const el = ref()
const { vnode, container } = mountWithHydration('<div></div>', () =>
h('div', { ref: el })
)
expect(vnode.el).toBe(container.firstChild)
expect(el.value).toBe(vnode.el)
})
test('Fragment', async () => {
const msg = ref('foo')
const fn = jest.fn()