Skip to content

Commit

Permalink
Use renderToStaticMarkup for tests (#16516)
Browse files Browse the repository at this point in the history
  • Loading branch information
devknoll authored and trueadm committed Aug 29, 2019
1 parent 980112b commit f61138e
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/react-dom/src/__tests__/ReactServerRendering-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ describe('ReactDOMServer', () => {
return <div>{this.state.text}</div>;
}
}
const markup = ReactDOMServer.renderToString(<Component />);
const markup = ReactDOMServer.renderToStaticMarkup(<Component />);
expect(markup).toContain('hello, world');
});

Expand All @@ -339,7 +339,7 @@ describe('ReactDOMServer', () => {
return <div>{this.state.text}</div>;
}
}
const markup = ReactDOMServer.renderToString(<Component />);
const markup = ReactDOMServer.renderToStaticMarkup(<Component />);
expect(markup).toContain('hello, world');
});

Expand All @@ -354,7 +354,7 @@ describe('ReactDOMServer', () => {
}
}

const markup = ReactDOMServer.renderToString(
const markup = ReactDOMServer.renderToStaticMarkup(
<Component text="hello, world" />,
);
expect(markup).toContain('hello, world');
Expand Down Expand Up @@ -391,7 +391,7 @@ describe('ReactDOMServer', () => {
text: PropTypes.string,
};

const markup = ReactDOMServer.renderToString(
const markup = ReactDOMServer.renderToStaticMarkup(
<ContextProvider>
<Component />
</ContextProvider>,
Expand Down Expand Up @@ -429,7 +429,7 @@ describe('ReactDOMServer', () => {
);
}

const markup = ReactDOMServer.renderToString(<App value={1} />);
const markup = ReactDOMServer.renderToStaticMarkup(<App value={1} />);
// Extract the numbers rendered by the consumers
const results = markup.match(/\d+/g).map(Number);
expect(results).toEqual([2, 1, 3, 1]);
Expand Down Expand Up @@ -467,7 +467,7 @@ describe('ReactDOMServer', () => {
);
}

const markup = ReactDOMServer.renderToString(<App value={1} />);
const markup = ReactDOMServer.renderToStaticMarkup(<App value={1} />);
// Extract the numbers rendered by the consumers
const results = markup.match(/\d+/g).map(Number);
expect(results).toEqual([2, 1, 3, 1]);
Expand All @@ -484,7 +484,7 @@ describe('ReactDOMServer', () => {

let reentrantMarkup;
function Reentrant() {
reentrantMarkup = ReactDOMServer.renderToString(
reentrantMarkup = ReactDOMServer.renderToStaticMarkup(
<App value={1} reentrant={false} />,
);
return null;
Expand Down Expand Up @@ -512,7 +512,7 @@ describe('ReactDOMServer', () => {
);
}

const markup = ReactDOMServer.renderToString(
const markup = ReactDOMServer.renderToStaticMarkup(
<App value={1} reentrant={true} />,
);
// Extract the numbers rendered by the consumers
Expand Down Expand Up @@ -566,7 +566,7 @@ describe('ReactDOMServer', () => {
},
}));

expect(ReactDOMServer.renderToString(<LazyFoo id="foo" />)).toEqual(
expect(ReactDOMServer.renderToStaticMarkup(<LazyFoo id="foo" />)).toEqual(
'<div id="foo">lazy</div>',
);
});
Expand All @@ -578,7 +578,7 @@ describe('ReactDOMServer', () => {
},
}));

expect(() => ReactDOMServer.renderToString(<LazyFoo />)).toThrow(
expect(() => ReactDOMServer.renderToStaticMarkup(<LazyFoo />)).toThrow(
'Bad lazy',
);
});
Expand Down

0 comments on commit f61138e

Please sign in to comment.