From b28ee2dcc5b3f36f5b6b893fff9a54b2871c5378 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 28 Feb 2022 11:23:36 +0100 Subject: [PATCH] test: add failing nested suspense for #1324 --- e2e/suspense/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/e2e/suspense/index.ts b/e2e/suspense/index.ts index 24f42c7ce..edf08fa8e 100644 --- a/e2e/suspense/index.ts +++ b/e2e/suspense/index.ts @@ -72,11 +72,19 @@ function createTestComponent( }) } -function createPassThroughWithSuspense(key: string) { +function createPassThroughWithSuspense(key: string, isAsync = false) { return defineComponent({ name: `PassThroughViewWithSuspense:${key}`, setup() { logs.value.push(`PassThrough:${key} setup`) + const route = useRoute() + const shouldFail = !!route.query.fail + + return isAsync + ? delay(100).then(() => + shouldFail ? Promise.reject(new Error('failed')) : {} + ) + : {} }, template: ` @@ -117,7 +125,7 @@ const router = createRouter({ }, { path: '/n/sus/one', - component: createPassThroughWithSuspense('sus-one'), + component: createPassThroughWithSuspense('sus-one', false), children: [ { path: 'child', @@ -127,7 +135,7 @@ const router = createRouter({ }, { path: '/n/sus/two', - component: createPassThroughWithSuspense('sus-two'), + component: createPassThroughWithSuspense('sus-two', true), children: [ { path: 'child',