feat: update Suspense usage (#2099)
See https://github.com/vuejs/vue-next/pull/2099 for details.
This commit is contained in:
@@ -506,8 +506,10 @@ describe('SSR hydration', () => {
|
||||
const App = {
|
||||
template: `
|
||||
<Suspense @resolve="done">
|
||||
<AsyncChild :n="1" />
|
||||
<AsyncChild :n="2" />
|
||||
<div>
|
||||
<AsyncChild :n="1" />
|
||||
<AsyncChild :n="2" />
|
||||
</div>
|
||||
</Suspense>`,
|
||||
components: {
|
||||
AsyncChild
|
||||
@@ -521,7 +523,7 @@ describe('SSR hydration', () => {
|
||||
// server render
|
||||
container.innerHTML = await renderToString(h(App))
|
||||
expect(container.innerHTML).toMatchInlineSnapshot(
|
||||
`"<!--[--><span>1</span><span>2</span><!--]-->"`
|
||||
`"<div><span>1</span><span>2</span></div>"`
|
||||
)
|
||||
// reset asyncDeps from ssr
|
||||
asyncDeps.length = 0
|
||||
@@ -537,17 +539,23 @@ describe('SSR hydration', () => {
|
||||
|
||||
// should flush buffered effects
|
||||
expect(mountedCalls).toMatchObject([1, 2])
|
||||
expect(container.innerHTML).toMatch(`<span>1</span><span>2</span>`)
|
||||
expect(container.innerHTML).toMatch(
|
||||
`<div><span>1</span><span>2</span></div>`
|
||||
)
|
||||
|
||||
const span1 = container.querySelector('span')!
|
||||
triggerEvent('click', span1)
|
||||
await nextTick()
|
||||
expect(container.innerHTML).toMatch(`<span>2</span><span>2</span>`)
|
||||
expect(container.innerHTML).toMatch(
|
||||
`<div><span>2</span><span>2</span></div>`
|
||||
)
|
||||
|
||||
const span2 = span1.nextSibling as Element
|
||||
triggerEvent('click', span2)
|
||||
await nextTick()
|
||||
expect(container.innerHTML).toMatch(`<span>2</span><span>3</span>`)
|
||||
expect(container.innerHTML).toMatch(
|
||||
`<div><span>2</span><span>3</span></div>`
|
||||
)
|
||||
})
|
||||
|
||||
test('async component', async () => {
|
||||
|
||||
Reference in New Issue
Block a user