Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DOM warning wording and link #10819

Merged
merged 2 commits into from
Sep 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/renderers/dom/shared/__tests__/ReactDOMAttribute-test.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the change from prop to value

'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
Original file line number Diff line number Diff line change
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