Skip to content

Commit

Permalink
test: add failing nested suspense for #1324
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 28, 2022
1 parent cf0281e commit b28ee2d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions e2e/suspense/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: `
Expand Down Expand Up @@ -117,7 +125,7 @@ const router = createRouter({
},
{
path: '/n/sus/one',
component: createPassThroughWithSuspense('sus-one'),
component: createPassThroughWithSuspense('sus-one', false),
children: [
{
path: 'child',
Expand All @@ -127,7 +135,7 @@ const router = createRouter({
},
{
path: '/n/sus/two',
component: createPassThroughWithSuspense('sus-two'),
component: createPassThroughWithSuspense('sus-two', true),
children: [
{
path: 'child',
Expand Down

0 comments on commit b28ee2d

Please sign in to comment.