Skip to content

Commit

Permalink
Add 'unmountComponentAtNode' call in test for reconciling pre-rendere…
Browse files Browse the repository at this point in the history
…d markup

**what is the change?:**
We have a test that verifies React can reconcile text from pre-rendered
mark-up. It tests React doing this for three strings and three empty
strings.

This adds a call to 'unmountComponentAtNode' between the two
expectations for strings and empty strings.

**why make this change?:**
We now warn when someone messes with the DOM inside of a node in such a
way that removes the React-rendered content. This test was doing that. I
can't think of a situation where this would happen with server-side
rendering without the need to call 'unmountComponentAtNode' before
inserting the server-side rendered content.

**test plan:**
`yarn test`

Only one more failing test, will fix that in the next commit.

**issue:**
facebook#8854
  • Loading branch information
flarnie committed Jul 20, 2017
1 parent c9a6e6c commit 194adf1
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -120,6 +120,8 @@ describe('ReactDOMTextComponent', () => {
ReactDOM.render(reactEl, el);
expect(el.textContent).toBe('foobarbaz');

ReactDOM.unmountComponentAtNode(el);

reactEl = <div>{''}{''}{''}</div>;
el.innerHTML = ReactDOMServer.renderToString(reactEl);

Expand Down

0 comments on commit 194adf1

Please sign in to comment.