Skip to content

Commit

Permalink
fixup! rename renderIntoDocument as renderDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff committed Jan 18, 2023
1 parent f20cff9 commit af13a1c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
34 changes: 16 additions & 18 deletions packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,9 @@ describe('ReactDOMFizzServer', () => {
mergeOptions(options, renderOptions),
);
}
function renderIntoDocumentAsPipeableStream(jsx, fallback, options) {
function renderDocumentAsPipeableStream(jsx, fallback, options) {
// Merge options with renderOptions, which may contain featureFlag specific behavior
return ReactDOMFizzServer.renderIntoDocumentAsPipeableStream(
return ReactDOMFizzServer.renderDocumentAsPipeableStream(
jsx,
fallback,
mergeOptions(options, renderOptions),
Expand Down Expand Up @@ -6165,15 +6165,13 @@ describe('ReactDOMFizzServer', () => {
});
});

describe('renderIntoDocument', () => {
describe('renderDocument', () => {
// @gate enableFloat && enableFizzIntoDocument
it('can render arbitrary HTML into a Document', async () => {
let content = '';
writable.on('data', chunk => (content += chunk));
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
<div id="div">foo</div>,
);
const {pipe} = renderDocumentAsPipeableStream(<div id="div">foo</div>);
pipe(writable);
});

Expand All @@ -6196,7 +6194,7 @@ describe('ReactDOMFizzServer', () => {
let content = '';
writable.on('data', chunk => (content += chunk));
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<body id="body">foo</body>,
);
pipe(writable);
Expand All @@ -6220,7 +6218,7 @@ describe('ReactDOMFizzServer', () => {
writable.on('data', chunk => (content += chunk));
await expect(async () => {
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<head id="head">
<title>a title</title>
Expand All @@ -6231,7 +6229,7 @@ describe('ReactDOMFizzServer', () => {
pipe(writable);
});
}).toErrorDev(
'A <head> tag was rendered with props when using `renderIntoDocument`. In this rendering mode React may emit the head tag early in some circumstances and therefore props on the <head> tag are not supported and may be missing in the rendered output for any particular render. In many cases props that are set on a <head> tag can be set on the <html> tag instead.',
'A <head> tag was rendered with props when using `renderDocument`. In this rendering mode React may emit the head tag early in some circumstances and therefore props on the <head> tag are not supported and may be missing in the rendered output for any particular render. In many cases props that are set on a <head> tag can be set on the <html> tag instead.',
);

expect(content.slice(0, 47)).toEqual(
Expand All @@ -6253,7 +6251,7 @@ describe('ReactDOMFizzServer', () => {
let content = '';
writable.on('data', chunk => (content += chunk));
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<body id="body">foo</body>
</html>,
Expand Down Expand Up @@ -6284,7 +6282,7 @@ describe('ReactDOMFizzServer', () => {

const errors = [];
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<body id="body">
<Throw />
Expand Down Expand Up @@ -6332,7 +6330,7 @@ describe('ReactDOMFizzServer', () => {

const errors = [];
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<BlockOn value="foo">
<body id="body">
Expand Down Expand Up @@ -6406,7 +6404,7 @@ describe('ReactDOMFizzServer', () => {

const errors = [];
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<link rel="stylesheet" href="foo" precedence="foo" />
<link rel="stylesheet" href="bar" precedence="bar" />
Expand Down Expand Up @@ -6459,7 +6457,7 @@ describe('ReactDOMFizzServer', () => {

const errors = [];
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<body id="body">
hello world
Expand Down Expand Up @@ -6505,7 +6503,7 @@ describe('ReactDOMFizzServer', () => {

const errors = [];
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<body id="body">
<Throw />
Expand Down Expand Up @@ -6550,7 +6548,7 @@ describe('ReactDOMFizzServer', () => {

const errors = [];
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<body id="body">
<BlockOn value="error">
Expand Down Expand Up @@ -6637,7 +6635,7 @@ describe('ReactDOMFizzServer', () => {
}

await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<head />
<body id="body">
Expand Down Expand Up @@ -6745,7 +6743,7 @@ describe('ReactDOMFizzServer', () => {
const errors = [];
try {
await act(() => {
const {pipe} = renderIntoDocumentAsPipeableStream(
const {pipe} = renderDocumentAsPipeableStream(
<html id="html">
<head />
<link rel="stylesheet" href="foo" precedence="foo" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,12 @@ describe('ReactDOMFizzServerBrowser', () => {
});
});

describe('renderIntoDocument', () => {
describe('renderDocument', () => {
// @gate enableFloat && enableFizzIntoDocument
it('can render into a container', async () => {
let content = '';
await act(async () => {
const stream = ReactDOMFizzServer.renderIntoDocument(<div>foo</div>);
const stream = ReactDOMFizzServer.renderDocument(<div>foo</div>);
const reader = stream.getReader();
while (true) {
const {done, value} = await reader.read();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,11 @@ describe('ReactDOMFizzServerNode', () => {
});
});

describe('renderIntoDocumentAsPipeableStream', () => {
describe('renderDocumentAsPipeableStream', () => {
// @gate enableFloat && enableFizzIntoDocument
it('can render into a container', async () => {
const {writable, output} = getTestWritable();
const {pipe} = ReactDOMFizzServer.renderIntoDocumentAsPipeableStream(
const {pipe} = ReactDOMFizzServer.renderDocumentAsPipeableStream(
<div>foo</div>,
);
pipe(writable);
Expand Down

0 comments on commit af13a1c

Please sign in to comment.