diff --git a/packages/runtime-core/__tests__/rendererSuspense.spec.ts b/packages/runtime-core/__tests__/rendererSuspense.spec.ts index 6f7e2d2d..a577c5e9 100644 --- a/packages/runtime-core/__tests__/rendererSuspense.spec.ts +++ b/packages/runtime-core/__tests__/rendererSuspense.spec.ts @@ -23,6 +23,7 @@ describe('renderer: suspense', () => { } }) + // TODO test mounted hook & watch callback buffering const AsyncChild = createAsyncComponent( () => new Promise(resolve => { @@ -36,6 +37,19 @@ describe('renderer: suspense', () => { }) ) + const AsyncChild2 = createAsyncComponent( + () => + new Promise(resolve => { + setTimeout(() => { + resolve({ + setup(props: { msg: string }) { + return () => h('div', props.msg) + } + }) + }, 10) + }) + ) + const Mid = { setup() { return () => @@ -49,7 +63,8 @@ describe('renderer: suspense', () => { name: 'root', setup() { // TODO test fallback - return () => h(Suspense, [msg.value, h(Mid)]) + return () => + h(Suspense, [msg.value, h(Mid), h(AsyncChild2, { msg: 'child 2' })]) } } @@ -59,6 +74,16 @@ describe('renderer: suspense', () => { await Promise.all(deps) await nextTick() - expect(serializeInner(root)).toBe(`hello
hello
`) + expect(serializeInner(root)).toBe( + `hello
hello
child 2
` + ) }) + + test.todo('fallback content update') + + test.todo('content update before suspense resolve') + + test.todo('unmount before suspense resolve') + + test.todo('nested suspense') })