Skip to content

Commit

Permalink
Fix facebook#3596: Refactoring warning message + renamed devtool: Rea…
Browse files Browse the repository at this point in the history
…ctDOMComponentCaseDevtool -> ReactDOMUnknownComponentDevtool
  • Loading branch information
eblin committed Jun 20, 2016
1 parent e73bdb1 commit b53569e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/renderers/dom/client/__tests__/ReactMount-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ describe('ReactMount', function() {
ReactDOM.render(<centered/>, container);
expect(console.error.calls.count()).toBe(1);
expect(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: ReactDOM.render(): Invalid component element: `centered`. ' +
'Make sure the component starts with an upper-case letter.'+
'Warning: Unknown element centered. Did you miss-spell an HTML tag name? ' +
'If you are using a custom component, make sure your custom component ' +
'starts with an upper-case letter.' +
'\n in centered (at **)'
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/dom/shared/ReactDOMDebugTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

var ReactDOMNullInputValuePropDevtool = require('ReactDOMNullInputValuePropDevtool');
var ReactDOMUnknownPropertyDevtool = require('ReactDOMUnknownPropertyDevtool');
var ReactDOMComponentCaseDevtool = require('ReactDOMComponentCaseDevtool');
var ReactDOMUnknownComponentDevtool = require('ReactDOMUnknownComponentDevtool');
var ReactDebugTool = require('ReactDebugTool');

var warning = require('warning');
Expand Down Expand Up @@ -71,6 +71,6 @@ var ReactDOMDebugTool = {

ReactDOMDebugTool.addDevtool(ReactDOMUnknownPropertyDevtool);
ReactDOMDebugTool.addDevtool(ReactDOMNullInputValuePropDevtool);
ReactDOMDebugTool.addDevtool(ReactDOMComponentCaseDevtool);
ReactDOMDebugTool.addDevtool(ReactDOMUnknownComponentDevtool);

module.exports = ReactDOMDebugTool;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMComponentCaseDevtool
* @providesModule ReactDOMUnknownComponentDevtool
*/

'use strict';
Expand All @@ -28,21 +28,22 @@ function handleElement(debugID, element) {

if (!didWarnAboutCase && invalidElement) {
warning(false,
'ReactDOM.render(): Invalid component element: `%s`. ' +
'Make sure the component starts with an upper-case letter.%s',
'Unknown element %s. Did you miss-spell an HTML tag name? ' +
'If you are using a custom component, make sure your custom component ' +
'starts with an upper-case letter.%s',
element.type,
ReactComponentTreeDevtool.getStackAddendumByID(debugID)
);
didWarnAboutCase = true;
}
}

var ReactDOMComponentCaseDevtool = {
var ReactDOMUnknownComponentDevtool = {
onBeforeMountComponent(debugID, element) {
handleElement(debugID, element);
},
onBeforeUpdateComponent(debugID, element) {
handleElement(debugID, element);
},
};
module.exports = ReactDOMComponentCaseDevtool;
module.exports = ReactDOMUnknownComponentDevtool;

0 comments on commit b53569e

Please # to comment.