@samitouri / QOS-React-2 / commits / f7276b304c

Add suppressContentEditableWarning

See #5837

Max committed Feb 24, 2016 at 20:32 UTC f7276b304c5de40de53f2a50ea9247afb2cf66b7
2 files changed +9 -1
src/renderers/dom/shared/ReactDOMComponent.js
+3 -1
@@ -174,7 +174,9 @@ function assertValidProps(component, props) {
174 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
175 );
176 warning(
177 - !props.contentEditable || props.children == null,
177 + props.suppressContentEditableWarning ||
178 + !props.contentEditable ||
179 + props.children == null,
180 'A component is `contentEditable` and contains `children` managed by ' +
181 'React. It is now your responsibility to guarantee that none of ' +
182 'those nodes are unexpectedly modified or duplicated. This is ' +
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+6
@@ -947,6 +947,12 @@ describe('ReactDOMComponent', function() {
947 expect(console.error.argsForCall[0][0]).toContain('contentEditable');
948 });
949
950 + it('should respect suppressContentEditableWarning', function() {
951 + spyOn(console, 'error');
952 + mountComponent({contentEditable: true, children: '', suppressContentEditableWarning: true});
953 + expect(console.error.argsForCall.length).toBe(0);
954 + });
955 +
956 it('should validate against invalid styles', function() {
957 expect(function() {
958 mountComponent({style: 'display: none'});