From 194adf1bc6167da1ffa1c7de50c044e20d58b334 Mon Sep 17 00:00:00 2001 From: Flarnie Marchan Date: Wed, 19 Jul 2017 09:06:29 -0700 Subject: [PATCH] Add 'unmountComponentAtNode' call in test for reconciling pre-rendered 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:** https://github.com/facebook/react/issues/8854 --- .../dom/shared/__tests__/ReactDOMTextComponent-test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js b/src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js index 167bca42b6f4..013eabaf04a1 100644 --- a/src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js +++ b/src/renderers/dom/shared/__tests__/ReactDOMTextComponent-test.js @@ -120,6 +120,8 @@ describe('ReactDOMTextComponent', () => { ReactDOM.render(reactEl, el); expect(el.textContent).toBe('foobarbaz'); + ReactDOM.unmountComponentAtNode(el); + reactEl =
{''}{''}{''}
; el.innerHTML = ReactDOMServer.renderToString(reactEl);