Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into fix/buffer-unusable-on-edge
- Loading branch information
Showing
15 changed files
with
111 additions
and
111 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
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
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
File renamed without changes.
File renamed without changes.
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 React from 'react' | ||
|
||
const NumberContext = React.createContext(0) | ||
|
||
export default function page() { | ||
return ( | ||
<NumberContext.Provider value={12345}> | ||
<NumberContext.Consumer> | ||
{(value) => <p>Value: {value}</p>} | ||
</NumberContext.Consumer> | ||
</NumberContext.Provider> | ||
) | ||
} | ||
|
||
export async function getServerSideProps() { | ||
return { props: {} } | ||
} |
File renamed without changes.
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,46 @@ | ||
import { join } from 'path' | ||
import { renderViaHTTP, check } from 'next-test-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
import { createNext, FileRef } from 'e2e-utils' | ||
|
||
describe('React Context', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: { | ||
pages: new FileRef(join(__dirname, 'app/pages')), | ||
'context.js': new FileRef(join(__dirname, 'app/context.js')), | ||
}, | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should render a page with context', async () => { | ||
const html = await renderViaHTTP(next.url, '/') | ||
expect(html).toMatch(/Value: .*?hello world/) | ||
}) | ||
|
||
it('should render correctly with context consumer', async () => { | ||
const html = await renderViaHTTP(next.url, '/consumer') | ||
expect(html).toMatch(/Value: .*?12345/) | ||
}) | ||
|
||
if ((globalThis as any).isNextDev) { | ||
it('should render with context after change', async () => { | ||
const aboutAppPagePath = 'pages/_app.js' | ||
const originalContent = await next.readFile(aboutAppPagePath) | ||
await next.patchFile( | ||
aboutAppPagePath, | ||
originalContent.replace('hello world', 'new value') | ||
) | ||
|
||
try { | ||
await check(() => renderViaHTTP(next.url, '/'), /Value: .*?new value/) | ||
} finally { | ||
await next.patchFile(aboutAppPagePath, originalContent) | ||
} | ||
await check(() => renderViaHTTP(next.url, '/'), /Value: .*?hello world/) | ||
}) | ||
} | ||
}) |
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 was deleted.
Oops, something went wrong.