-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
86 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { AppCtx, Page, devFixture } from '../utils'; | ||
|
||
jest.setTimeout(5 * 60 * 1000); | ||
|
||
describe('custom routes', () => { | ||
let ctx: AppCtx; | ||
let page: Page; | ||
|
||
beforeAll(async () => { | ||
ctx = await devFixture('custom-routes'); | ||
}); | ||
afterAll(async () => { | ||
await ctx.close(); | ||
}); | ||
afterEach(async () => { | ||
await page.close(); | ||
}); | ||
it('should support redirect', async () => { | ||
page = await ctx.browser.page(ctx.url('/redirect0')); | ||
expect(await page.$text('#index')).toBe('Index Page'); | ||
}); | ||
|
||
test('should support nest redirect', async () => { | ||
page = await ctx.browser.page(ctx.url('/redirect1')); | ||
expect(await page.$text('#about')).toBe('About Page'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "custom-routes", | ||
"dependencies": { | ||
"shuvi": "workspace:*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default { | ||
ssr: true, | ||
routes: [ | ||
{ | ||
path: '/', | ||
component: 'layout', | ||
children: [ | ||
{ path: '/redirect0', redirect: '/' }, | ||
{ path: '', component: 'page' }, | ||
{ path: '/redirect1', redirect: '/redirect2' }, | ||
{ path: '/redirect2', redirect: '/about' }, | ||
{ path: '/about', component: 'about/page' } | ||
] | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default () => <div id="about">About Page</div>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { RouterView } from '@shuvi/runtime'; | ||
import React from 'react'; | ||
|
||
const MyApp = () => { | ||
return <RouterView />; | ||
}; | ||
|
||
export default MyApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Entry() { | ||
return <div id="index">Index Page</div>; | ||
} |