Skip to content

Commit

Permalink
Update DOM warning wording and link (#10819)
Browse files Browse the repository at this point in the history
* Update DOM warning wording and link

* Consistently use "Invalid" for known misspellings
  • Loading branch information
gaearon committed Sep 25, 2017
1 parent 6e8c09c commit b24d23d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions src/renderers/dom/shared/__tests__/ReactDOMAttribute-test.js
Expand Up @@ -112,9 +112,9 @@ describe('ReactDOM unknown attribute', () => {

testUnknownAttributeRemoval(Symbol('foo'));
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Invalid prop `unknown` on <div> tag. Either remove this ' +
'prop from the element, or pass a string or number value to keep it ' +
'in the DOM. For details, see https://fb.me/react-unknown-prop\n' +
'Warning: Invalid value for prop `unknown` on <div> tag. Either remove it ' +
'from the element, or pass a string or number value to keep it ' +
'in the DOM. For details, see https://fb.me/react-attribute-behavior\n' +
' in div (at **)',
);
expectDev(console.error.calls.count()).toBe(1);
Expand All @@ -125,10 +125,10 @@ describe('ReactDOM unknown attribute', () => {

testUnknownAttributeRemoval(function someFunction() {});
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Invalid prop `unknown` on <div> tag. Either remove this ' +
'prop from the element, or pass a string or number value to ' +
'Warning: Invalid value for prop `unknown` on <div> tag. Either remove ' +
'it from the element, or pass a string or number value to ' +
'keep it in the DOM. For details, see ' +
'https://fb.me/react-unknown-prop\n' +
'https://fb.me/react-attribute-behavior\n' +
' in div (at **)',
);
expectDev(console.error.calls.count()).toBe(1);
Expand Down
20 changes: 10 additions & 10 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Expand Up @@ -148,9 +148,9 @@ describe('ReactDOMComponent', () => {
ReactDOM.render(<div foo={() => {}} />, container);
expectDev(console.error.calls.count(0)).toBe(1);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Invalid prop `foo` on <div> tag. Either remove this prop ' +
'Warning: Invalid value for prop `foo` on <div> tag. Either remove it ' +
'from the element, or pass a string or number value to keep ' +
'it in the DOM. For details, see https://fb.me/react-unknown-prop' +
'it in the DOM. For details, see https://fb.me/react-attribute-behavior' +
'\n in div (at **)',
);
});
Expand All @@ -161,9 +161,9 @@ describe('ReactDOMComponent', () => {
ReactDOM.render(<div foo={() => {}} baz={() => {}} />, container);
expectDev(console.error.calls.count(0)).toBe(1);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Invalid props `foo`, `baz` on <div> tag. Either remove these ' +
'props from the element, or pass a string or number value to keep ' +
'them in the DOM. For details, see https://fb.me/react-unknown-prop' +
'Warning: Invalid values for props `foo`, `baz` on <div> tag. Either remove ' +
'them from the element, or pass a string or number value to keep ' +
'them in the DOM. For details, see https://fb.me/react-attribute-behavior' +
'\n in div (at **)',
);
});
Expand All @@ -174,7 +174,7 @@ describe('ReactDOMComponent', () => {
ReactDOM.render(<div onDblClick={() => {}} />, container);
expectDev(console.error.calls.count(0)).toBe(1);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Unknown event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
'Warning: Invalid event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
);
});

Expand Down Expand Up @@ -1732,7 +1732,7 @@ describe('ReactDOMComponent', () => {
'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
'Warning: Unknown event handler property `onclick`. Did you mean ' +
'Warning: Invalid event handler property `onclick`. Did you mean ' +
'`onClick`?\n in input (at **)',
);
});
Expand All @@ -1746,7 +1746,7 @@ describe('ReactDOMComponent', () => {
'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
'Warning: Unknown event handler property `onclick`. Did you mean ' +
'Warning: Invalid event handler property `onclick`. Did you mean ' +
'`onClick`?\n in input (at **)',
);
});
Expand Down Expand Up @@ -2115,7 +2115,7 @@ describe('ReactDOMComponent', () => {
expect(el.hasAttribute('whatever')).toBe(false);

expectDev(console.error.calls.argsFor(0)[0]).toContain(
'Warning: Invalid prop `whatever` on <div> tag',
'Warning: Invalid value for prop `whatever` on <div> tag',
);
});

Expand Down Expand Up @@ -2186,7 +2186,7 @@ describe('ReactDOMComponent', () => {
expect(el.hasAttribute('whatever')).toBe(false);

expectDev(console.error.calls.argsFor(0)[0]).toContain(
'Warning: Invalid prop `whatever` on <div> tag.',
'Warning: Invalid value for prop `whatever` on <div> tag.',
);
});

Expand Down
10 changes: 5 additions & 5 deletions src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js
Expand Up @@ -73,7 +73,7 @@ if (__DEV__) {
if (registrationName != null) {
warning(
false,
'Unknown event handler property `%s`. Did you mean `%s`?%s',
'Invalid event handler property `%s`. Did you mean `%s`?%s',
name,
registrationName,
getStackAddendum(debugID),
Expand Down Expand Up @@ -234,19 +234,19 @@ var warnUnknownProperties = function(type, props, debugID) {
if (unknownProps.length === 1) {
warning(
false,
'Invalid prop %s on <%s> tag. Either remove this prop from the element, ' +
'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' +
'or pass a string or number value to keep it in the DOM. ' +
'For details, see https://fb.me/react-unknown-prop%s',
'For details, see https://fb.me/react-attribute-behavior%s',
unknownPropString,
type,
getStackAddendum(debugID),
);
} else if (unknownProps.length > 1) {
warning(
false,
'Invalid props %s on <%s> tag. Either remove these props from the element, ' +
'Invalid values for props %s on <%s> tag. Either remove them from the element, ' +
'or pass a string or number value to keep them in the DOM. ' +
'For details, see https://fb.me/react-unknown-prop%s',
'For details, see https://fb.me/react-attribute-behavior%s',
unknownPropString,
type,
getStackAddendum(debugID),
Expand Down

0 comments on commit b24d23d

Please sign in to comment.