-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
149 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
{} | ||
{ | ||
"frank-example-Site": {} | ||
} |
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
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 APage() { | ||
return <div>A 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,9 @@ | ||
import Link from "next/link"; | ||
|
||
export default function A() { | ||
return <div className="border p-4"> | ||
<h1>Parallel Route A</h1> | ||
<Link href="/parallel/a-page">Go to a-page</Link> | ||
|
||
</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,3 @@ | ||
export default function BPage() { | ||
return <div>B 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,9 @@ | ||
import Link from "next/link"; | ||
|
||
export default function B() { | ||
return <div className="border p-4"> | ||
<h1>Parallel Route B</h1> | ||
|
||
<Link href="/parallel/b-page">Go to b-page</Link> | ||
</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,29 @@ | ||
'use client' | ||
import { ReactNode, useState } from "react"; | ||
|
||
export default function Layout({ a, b, children }: { children: ReactNode, a: ReactNode, b: ReactNode }) { | ||
const [routeA, setRouteA] = useState(false) | ||
const [routeB, setRouteB] = useState(false) | ||
|
||
return <div> | ||
|
||
<div className="flex flex-col mb-10"> | ||
<label htmlFor="a"> | ||
Enable A | ||
<input name="a" type="checkbox" checked={routeA} onChange={(e) => { | ||
setRouteA(e.target.checked) | ||
}} /> | ||
</label> | ||
<label htmlFor="b"> | ||
Enable B | ||
<input name="b" type="checkbox" checked={routeB} onChange={(e) => { | ||
setRouteB(e.target.checked) | ||
}} /> | ||
</label> | ||
</div> | ||
|
||
{routeA && a} | ||
{routeB && b} | ||
{/* {children} */} | ||
</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,3 @@ | ||
export default function Page() { | ||
return null | ||
} |
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
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 @@ | ||
/// <reference path="../../example/.sst/types/index.ts" /> |
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
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
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,42 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
test("Parallel routes", async ({ page }) => { | ||
await page.goto("/"); | ||
await page.getByRole("link", { name: "Parallel" }).click(); | ||
|
||
await page.waitForURL(`/parallel`); | ||
|
||
// Neither are selected, so A/B shouldn't be rendered | ||
let routeA = page.getByText("Parallel Route A"); | ||
let routeB = page.getByText("Parallel Route B"); | ||
await expect(routeA).not.toBeVisible(); | ||
await expect(routeB).not.toBeVisible(); | ||
|
||
// Enable A, which should be visible but not B | ||
await page.locator('input[name="a"]').check(); | ||
routeA = page.getByText("Parallel Route A"); | ||
await expect(routeA).toBeVisible(); | ||
await expect(routeB).not.toBeVisible(); | ||
|
||
// Enable B, both should be visible | ||
await page.locator('input[name="b"]').check(); | ||
routeB = page.getByText("Parallel Route B"); | ||
await expect(routeA).toBeVisible(); | ||
await expect(routeB).toBeVisible(); | ||
|
||
// Click on A, should go to a-page | ||
await page.getByText("Go to a-page").click(); | ||
await page.waitForURL("/parallel/a-page"); | ||
|
||
// Should render contents of a-page | ||
routeA = page.getByText("A Page"); | ||
await expect(routeA).toBeVisible(); | ||
|
||
// Click on B, should go to b-page | ||
await page.getByText("Go to b-page").click(); | ||
await page.waitForURL("/parallel/b-page"); | ||
|
||
// Should render contents of b-page | ||
routeB = page.getByText("B Page"); | ||
await expect(routeB).toBeVisible(); | ||
}); |