Added component stack to contentEditable warning (#11208)
* Added component stack to contentEditable warning * Added component stack to contentEditable warning
Ethan Arrowood committed
Oct 18, 2017 at 08:59 UTC
a3a10db22c70eb562ce0dc6e7c268642a85c1c01
2 files changed
+9
-2
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+6
-1
@@ -1126,7 +1126,12 @@ describe('ReactDOMComponent', () => {
1126
spyOn(console, 'error');
1127
mountComponent({contentEditable: true, children: ''});
1128
expectDev(console.error.calls.count()).toBe(1);
1129
- expectDev(console.error.calls.argsFor(0)[0]).toContain('contentEditable');
1129
+ expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
1130
+ 'Warning: A component is `contentEditable` and contains `children` ' +
1131
+ 'managed by React. It is now your responsibility to guarantee that ' +
1132
+ 'none of those nodes are unexpectedly modified or duplicated. This ' +
1133
+ 'is probably not intentional.\n in div (at **)',
1134
+ );
1135
});
1136
1137
it('should respect suppressContentEditableWarning', () => {
src/renderers/dom/shared/utils/assertValidProps.js
+3
-1
@@ -13,6 +13,7 @@ var invariant = require('fbjs/lib/invariant');
13
var voidElementTags = require('voidElementTags');
14
15
if (__DEV__) {
16
+ var {getCurrentFiberStackAddendum} = require('ReactDebugCurrentFiber');
17
var warning = require('fbjs/lib/warning');
18
}
19
@@ -68,7 +69,8 @@ function assertValidProps(
69
'A component is `contentEditable` and contains `children` managed by ' +
70
'React. It is now your responsibility to guarantee that none of ' +
71
'those nodes are unexpectedly modified or duplicated. This is ' +
71
- 'probably not intentional.',
72
+ 'probably not intentional.%s',
73
+ getCurrentFiberStackAddendum() || '',
74
);
75
}
76
invariant(