-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give layouts access to the props that the app is booted with
- Loading branch information
Showing
7 changed files
with
99 additions
and
15 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
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,14 @@ | ||
import React, { Suspense } from 'react' | ||
|
||
const Layout = (props: { children: React.ReactNode; bootProps: Record<string, any> }) => { | ||
return ( | ||
<Suspense fallback={<div>Loading...</div>}> | ||
<pre id="bootprops"> | ||
<code>{JSON.stringify(props.bootProps)}</code> | ||
</pre> | ||
{props.children} | ||
</Suspense> | ||
) | ||
} | ||
|
||
export default Layout |
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
"react-dom": "*" | ||
}, | ||
"devDependencies": { | ||
"@playwright/test": "^1.23.0", | ||
"html-validator": "^5.1.18" | ||
} | ||
} |
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,17 @@ | ||
import { expect } from '@playwright/test' | ||
import { Page } from 'playwright-chromium' | ||
import { newTestPage, reactReady, rootURL } from '../../helpers' | ||
|
||
describe('boot props', () => { | ||
let page: Page | ||
|
||
beforeEach(async () => { | ||
page = await newTestPage() | ||
}) | ||
|
||
test('should make the boot props available to the layout', async () => { | ||
await page.goto(`${rootURL}/bootprops/test`) | ||
await reactReady(page) | ||
await (expect(page.locator('#bootprops')) as any).toContainText('this is a boot prop') | ||
}) | ||
}) |
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