]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: add failing nested suspense for #1324
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 28 Feb 2022 10:23:36 +0000 (11:23 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 28 Feb 2022 10:23:36 +0000 (11:23 +0100)
e2e/suspense/index.ts

index 24f42c7ce2599e4009d13f3b24c18aba34141011..edf08fa8ed0ff4c72e4a4bb4407562bbb1569be9 100644 (file)
@@ -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',