Przeglądaj źródła

test for ssr rendering async components

Evan You 9 lat temu
rodzic
commit
8262edcd22
1 zmienionych plików z 17 dodań i 0 usunięć
  1. 17 0
      test/ssr/ssr-string.spec.js

+ 17 - 0
test/ssr/ssr-string.spec.js

@@ -877,6 +877,23 @@ describe('SSR: renderToString', () => {
       done()
     })
   })
+
+  it('render async components', done => {
+    const Foo = () => Promise.resolve({
+      render: h => h('div', [h('span', 'foo'), h(Bar)])
+    })
+    const Bar = () => ({
+      component: Promise.resolve({
+        render: h => h('span', 'bar')
+      })
+    })
+    renderVmWithOptions({
+      render: h => h(Foo)
+    }, res => {
+      expect(res).toContain(`<div data-server-rendered="true"><span>foo</span><span>bar</span></div>`)
+      done()
+    })
+  })
 })
 
 function renderVmWithOptions (options, cb) {