Skip to content

Commit

Permalink
Add surpressContentEditableWarning
Browse files Browse the repository at this point in the history
See #5837
  • Loading branch information
mxstbr committed Feb 24, 2016
1 parent 308badb commit 35484e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ function assertValidProps(component, props) {
'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
);
warning(
!props.contentEditable || props.children == null,
props.surpressContentEditableWarning ||
!props.contentEditable ||
props.children == null,
'A component is `contentEditable` and contains `children` managed by ' +
'React. It is now your responsibility to guarantee that none of ' +
'those nodes are unexpectedly modified or duplicated. This is ' +
Expand Down
6 changes: 6 additions & 0 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,12 @@ describe('ReactDOMComponent', function() {
expect(console.error.argsForCall[0][0]).toContain('contentEditable');
});

it('should respect suppressContentEditableWarning', function() {
spyOn(console, 'error');
mountComponent({contentEditable: true, children: '', suppressContentEditableWarning: true});
expect(console.error.argsForCall.length).toBe(0);
});

it('should validate against invalid styles', function() {
expect(function() {
mountComponent({style: 'display: none'});
Expand Down

0 comments on commit 35484e5

Please sign in to comment.