From 27535e7bfcb63e8a4d65f273311e380b4ca12eff Mon Sep 17 00:00:00 2001 From: Nicole Levy Date: Wed, 4 Apr 2018 17:21:06 -0400 Subject: [PATCH] Clarify ReactDOM's case warning for html tags (#12533) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update warning text * update tests to match * `yarn prettier` * include note on HTML5 custom elements * dan’s copy suggestion * remove ‘letters’ --- .../src/__tests__/ReactDOMComponent-test.js | 16 +++++++++++++--- .../ReactServerRendering-test.internal.js | 10 ++++++---- .../src/client/ReactDOMFiberComponent.js | 5 +++-- .../react-dom/src/server/ReactPartialRenderer.js | 5 +++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index 2df33293fae3f..0e2986a1f5d34 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -1000,7 +1000,11 @@ describe('ReactDOMComponent', () => { expect(() => { returnedValue = ReactDOMServer.renderToString(); - }).toWarnDev('
is using uppercase HTML.'); + }).toWarnDev( + '
is using incorrect casing. ' + + 'Use PascalCase for React components, ' + + 'or lowercase for HTML elements.', + ); expect(returnedValue).not.toContain('
'); }); @@ -1012,7 +1016,11 @@ describe('ReactDOMComponent', () => { expect(() => ReactTestUtils.renderIntoDocument(React.createElement('IMG')), - ).toWarnDev(' is using uppercase HTML.'); + ).toWarnDev( + ' is using incorrect casing. ' + + 'Use PascalCase for React components, ' + + 'or lowercase for HTML elements.', + ); }); it('should warn on props reserved for future use', () => { @@ -1059,7 +1067,9 @@ describe('ReactDOMComponent', () => { expect(() => ReactTestUtils.renderIntoDocument(), ).toWarnDev([ - ' is using uppercase HTML', + ' is using incorrect casing. ' + + 'Use PascalCase for React components, ' + + 'or lowercase for HTML elements.', 'The tag is unrecognized in this browser', ]); } finally { diff --git a/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js b/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js index 45fca606342f4..05eb32ba037a8 100644 --- a/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js @@ -602,11 +602,13 @@ describe('ReactDOMServer', () => { , ), ).toWarnDev([ - 'Warning: is using uppercase HTML. Always use lowercase ' + - 'HTML tags in React.', + 'Warning: is using incorrect casing. ' + + 'Use PascalCase for React components, ' + + 'or lowercase for HTML elements.', // linearGradient doesn't warn - 'Warning: