Update DOM warning wording and link (#10819)
* Update DOM warning wording and link * Consistently use "Invalid" for known misspellings
Dan Abramov committed
Sep 26, 2017 at 00:28 UTC
b24d23d3e81062a75356f0bf2a7070ae5db3bc18
3 files changed
+21
-21
src/renderers/dom/shared/__tests__/ReactDOMAttribute-test.js
+6
-6
@@ -112,9 +112,9 @@ describe('ReactDOM unknown attribute', () => {
112
113
testUnknownAttributeRemoval(Symbol('foo'));
114
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
115
- 'Warning: Invalid prop `unknown` on <div> tag. Either remove this ' +
116
- 'prop from the element, or pass a string or number value to keep it ' +
117
- 'in the DOM. For details, see https://fb.me/react-unknown-prop\n' +
115
+ 'Warning: Invalid value for prop `unknown` on <div> tag. Either remove it ' +
116
+ 'from the element, or pass a string or number value to keep it ' +
117
+ 'in the DOM. For details, see https://fb.me/react-attribute-behavior\n' +
118
' in div (at **)',
119
);
120
expectDev(console.error.calls.count()).toBe(1);
@@ -125,10 +125,10 @@ describe('ReactDOM unknown attribute', () => {
125
126
testUnknownAttributeRemoval(function someFunction() {});
127
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
128
- 'Warning: Invalid prop `unknown` on <div> tag. Either remove this ' +
129
- 'prop from the element, or pass a string or number value to ' +
128
+ 'Warning: Invalid value for prop `unknown` on <div> tag. Either remove ' +
129
+ 'it from the element, or pass a string or number value to ' +
130
'keep it in the DOM. For details, see ' +
131
- 'https://fb.me/react-unknown-prop\n' +
131
+ 'https://fb.me/react-attribute-behavior\n' +
132
' in div (at **)',
133
);
134
expectDev(console.error.calls.count()).toBe(1);
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+10
-10
@@ -148,9 +148,9 @@ describe('ReactDOMComponent', () => {
148
ReactDOM.render(<div foo={() => {}} />, container);
149
expectDev(console.error.calls.count(0)).toBe(1);
150
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
151
- 'Warning: Invalid prop `foo` on <div> tag. Either remove this prop ' +
151
+ 'Warning: Invalid value for prop `foo` on <div> tag. Either remove it ' +
152
'from the element, or pass a string or number value to keep ' +
153
- 'it in the DOM. For details, see https://fb.me/react-unknown-prop' +
153
+ 'it in the DOM. For details, see https://fb.me/react-attribute-behavior' +
154
'\n in div (at **)',
155
);
156
});
@@ -161,9 +161,9 @@ describe('ReactDOMComponent', () => {
161
ReactDOM.render(<div foo={() => {}} baz={() => {}} />, container);
162
expectDev(console.error.calls.count(0)).toBe(1);
163
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
164
- 'Warning: Invalid props `foo`, `baz` on <div> tag. Either remove these ' +
165
- 'props from the element, or pass a string or number value to keep ' +
166
- 'them in the DOM. For details, see https://fb.me/react-unknown-prop' +
164
+ 'Warning: Invalid values for props `foo`, `baz` on <div> tag. Either remove ' +
165
+ 'them from the element, or pass a string or number value to keep ' +
166
+ 'them in the DOM. For details, see https://fb.me/react-attribute-behavior' +
167
'\n in div (at **)',
168
);
169
});
@@ -174,7 +174,7 @@ describe('ReactDOMComponent', () => {
174
ReactDOM.render(<div onDblClick={() => {}} />, container);
175
expectDev(console.error.calls.count(0)).toBe(1);
176
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
177
- 'Warning: Unknown event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
177
+ 'Warning: Invalid event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
178
);
179
});
180
@@ -1732,7 +1732,7 @@ describe('ReactDOMComponent', () => {
1732
'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
1733
);
1734
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1735
- 'Warning: Unknown event handler property `onclick`. Did you mean ' +
1735
+ 'Warning: Invalid event handler property `onclick`. Did you mean ' +
1736
'`onClick`?\n in input (at **)',
1737
);
1738
});
@@ -1746,7 +1746,7 @@ describe('ReactDOMComponent', () => {
1746
'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
1747
);
1748
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(1)[0])).toBe(
1749
- 'Warning: Unknown event handler property `onclick`. Did you mean ' +
1749
+ 'Warning: Invalid event handler property `onclick`. Did you mean ' +
1750
'`onClick`?\n in input (at **)',
1751
);
1752
});
@@ -2115,7 +2115,7 @@ describe('ReactDOMComponent', () => {
2115
expect(el.hasAttribute('whatever')).toBe(false);
2116
2117
expectDev(console.error.calls.argsFor(0)[0]).toContain(
2118
- 'Warning: Invalid prop `whatever` on <div> tag',
2118
+ 'Warning: Invalid value for prop `whatever` on <div> tag',
2119
);
2120
});
2121
@@ -2186,7 +2186,7 @@ describe('ReactDOMComponent', () => {
2186
expect(el.hasAttribute('whatever')).toBe(false);
2187
2188
expectDev(console.error.calls.argsFor(0)[0]).toContain(
2189
- 'Warning: Invalid prop `whatever` on <div> tag.',
2189
+ 'Warning: Invalid value for prop `whatever` on <div> tag.',
2190
);
2191
});
2192
src/renderers/dom/shared/hooks/ReactDOMUnknownPropertyHook.js
+5
-5
@@ -73,7 +73,7 @@ if (__DEV__) {
73
if (registrationName != null) {
74
warning(
75
false,
76
- 'Unknown event handler property `%s`. Did you mean `%s`?%s',
76
+ 'Invalid event handler property `%s`. Did you mean `%s`?%s',
77
name,
78
registrationName,
79
getStackAddendum(debugID),
@@ -234,9 +234,9 @@ var warnUnknownProperties = function(type, props, debugID) {
234
if (unknownProps.length === 1) {
235
warning(
236
false,
237
- 'Invalid prop %s on <%s> tag. Either remove this prop from the element, ' +
237
+ 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' +
238
'or pass a string or number value to keep it in the DOM. ' +
239
- 'For details, see https://fb.me/react-unknown-prop%s',
239
+ 'For details, see https://fb.me/react-attribute-behavior%s',
240
unknownPropString,
241
type,
242
getStackAddendum(debugID),
@@ -244,9 +244,9 @@ var warnUnknownProperties = function(type, props, debugID) {
244
} else if (unknownProps.length > 1) {
245
warning(
246
false,
247
- 'Invalid props %s on <%s> tag. Either remove these props from the element, ' +
247
+ 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' +
248
'or pass a string or number value to keep them in the DOM. ' +
249
- 'For details, see https://fb.me/react-unknown-prop%s',
249
+ 'For details, see https://fb.me/react-attribute-behavior%s',
250
unknownPropString,
251
type,
252
getStackAddendum(debugID),