From 256149db43fe98259b0dcd639fd4f5ee36512f26 Mon Sep 17 00:00:00 2001 From: Brandon Dail Date: Sun, 3 Jun 2018 15:55:30 -0700 Subject: [PATCH] Failing test for context bug in SSR --- ...eactDOMServerIntegrationNewContext-test.js | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js index c3c08eb6bf773..5943c79a86a4c 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationNewContext-test.js @@ -191,5 +191,35 @@ describe('ReactDOMServerIntegration', () => { expect(e.querySelector('#theme').textContent).toBe('light'); expect(e.querySelector('#language').textContent).toBe('english'); }); + + itRenders( + 'unbalanced nested contexts across multiple renders', + async render => { + const Theme = React.createContext('dark'); + const Language = React.createContext('french'); + + const App = () => ( +
+ + + {language => ( + + {theme => ( + + {language} - {theme} + + )} + + )} + + +
+ ); + let e = await render(); + expect(e.textContent).toBe('french - light'); + e = await render(); + expect(e.textContent).toBe('french - light'); + }, + ); }); });