|
|
@@ -1880,6 +1880,26 @@ describe('SSR hydration', () => {
|
|
|
expect(root.innerHTML).toBe('<div><div>bar</div></div>')
|
|
|
})
|
|
|
|
|
|
+ test('hmr root reload', async () => {
|
|
|
+ const appId = 'test-app-id'
|
|
|
+ const App = {
|
|
|
+ __hmrId: appId,
|
|
|
+ template: `<div>foo</div>`,
|
|
|
+ }
|
|
|
+
|
|
|
+ const root = document.createElement('div')
|
|
|
+ root.innerHTML = await renderToString(h(App))
|
|
|
+ createSSRApp(App).mount(root)
|
|
|
+ expect(root.innerHTML).toBe('<div>foo</div>')
|
|
|
+
|
|
|
+ reload(appId, {
|
|
|
+ __hmrId: appId,
|
|
|
+ template: `<div>bar</div>`,
|
|
|
+ })
|
|
|
+ await nextTick()
|
|
|
+ expect(root.innerHTML).toBe('<div>bar</div>')
|
|
|
+ })
|
|
|
+
|
|
|
describe('mismatch handling', () => {
|
|
|
test('text node', () => {
|
|
|
const { container } = mountWithHydration(`foo`, () => 'bar')
|