Skip to content

Commit

Permalink
Reword invariant message about empty tags (fixes #7065) (#7066)
Browse files Browse the repository at this point in the history
* addresses issue #7065

* fix test to use new message

* fix string in tests

* fix test string

* Update error message and tests

(cherry picked from commit f949125)
  • Loading branch information
starkch authored and zpao committed Jul 8, 2016
1 parent 20d2398 commit e23690a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ function assertValidProps(component, props) {
if (voidElementTags[component._tag]) {
invariant(
props.children == null && props.dangerouslySetInnerHTML == null,
'%s is a void element tag and must not have `children` or ' +
'use `props.dangerouslySetInnerHTML`.%s',
'%s is a void element tag and must neither have `children` nor ' +
'use `dangerouslySetInnerHTML`.%s',
component._tag,
component._currentElement._owner ?
' Check the render method of ' +
Expand Down
24 changes: 12 additions & 12 deletions src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,8 @@ describe('ReactDOMComponent', function() {
expect(function() {
ReactDOM.render(<input>children</input>, container);
}).toThrowError(
'input is a void element tag and must not have `children` or ' +
'use `props.dangerouslySetInnerHTML`.'
'input is a void element tag and must neither have `children` nor ' +
'use `dangerouslySetInnerHTML`.'
);
});

Expand All @@ -825,8 +825,8 @@ describe('ReactDOMComponent', function() {
container
);
}).toThrowError(
'input is a void element tag and must not have `children` or use ' +
'`props.dangerouslySetInnerHTML`.'
'input is a void element tag and must neither have `children` nor use ' +
'`dangerouslySetInnerHTML`.'
);
});

Expand All @@ -840,8 +840,8 @@ describe('ReactDOMComponent', function() {
expect(function() {
ReactDOM.render(<menu><menuitem>children</menuitem></menu>, container);
}).toThrowError(
'menuitem is a void element tag and must not have `children` or use ' +
'`props.dangerouslySetInnerHTML`.'
'menuitem is a void element tag and must neither have `children` nor use ' +
'`dangerouslySetInnerHTML`.'
);

});
Expand Down Expand Up @@ -977,8 +977,8 @@ describe('ReactDOMComponent', function() {
expect(function() {
ReactDOM.render(<X />, container);
}).toThrowError(
'input is a void element tag and must not have `children` ' +
'or use `props.dangerouslySetInnerHTML`. Check the render method of X.'
'input is a void element tag and must neither have `children` ' +
'nor use `dangerouslySetInnerHTML`. Check the render method of X.'
);
});

Expand Down Expand Up @@ -1007,8 +1007,8 @@ describe('ReactDOMComponent', function() {
expect(function() {
ReactDOM.render(<input>children</input>, container);
}).toThrowError(
'input is a void element tag and must not have `children` or use ' +
'`props.dangerouslySetInnerHTML`.'
'input is a void element tag and must neither have `children` nor use ' +
'`dangerouslySetInnerHTML`.'
);
});

Expand All @@ -1021,8 +1021,8 @@ describe('ReactDOMComponent', function() {
container
);
}).toThrowError(
'input is a void element tag and must not have `children` or use ' +
'`props.dangerouslySetInnerHTML`.'
'input is a void element tag and must neither have `children` nor use ' +
'`dangerouslySetInnerHTML`.'
);
});

Expand Down

0 comments on commit e23690a

Please sign in to comment.