Reword invariant message about empty tags (fixes #7065) (#7066)
* addresses issue #7065 * fix test to use new message * fix string in tests * fix test string * Update error message and tests
starkch committed
Jun 27, 2016 at 18:30 UTC
f94912516fc54f7ddd6fb3a2b6925efe6481b3d4
2 files changed
+14
-14
src/renderers/dom/shared/ReactDOMComponent.js
+2
-2
@@ -155,8 +155,8 @@ function assertValidProps(component, props) {
155
if (voidElementTags[component._tag]) {
156
invariant(
157
props.children == null && props.dangerouslySetInnerHTML == null,
158
- '%s is a void element tag and must not have `children` or ' +
159
- 'use `props.dangerouslySetInnerHTML`.%s',
158
+ '%s is a void element tag and must neither have `children` nor ' +
159
+ 'use `dangerouslySetInnerHTML`.%s',
160
component._tag,
161
component._currentElement._owner ?
162
' Check the render method of ' +
src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js
+12
-12
@@ -759,8 +759,8 @@ describe('ReactDOMComponent', function() {
759
expect(function() {
760
ReactDOM.render(<input>children</input>, container);
761
}).toThrowError(
762
- 'input is a void element tag and must not have `children` or ' +
763
- 'use `props.dangerouslySetInnerHTML`.'
762
+ 'input is a void element tag and must neither have `children` nor ' +
763
+ 'use `dangerouslySetInnerHTML`.'
764
);
765
});
766
@@ -773,8 +773,8 @@ describe('ReactDOMComponent', function() {
773
container
774
);
775
}).toThrowError(
776
- 'input is a void element tag and must not have `children` or use ' +
777
- '`props.dangerouslySetInnerHTML`.'
776
+ 'input is a void element tag and must neither have `children` nor use ' +
777
+ '`dangerouslySetInnerHTML`.'
778
);
779
});
780
@@ -788,8 +788,8 @@ describe('ReactDOMComponent', function() {
788
expect(function() {
789
ReactDOM.render(<menu><menuitem>children</menuitem></menu>, container);
790
}).toThrowError(
791
- 'menuitem is a void element tag and must not have `children` or use ' +
792
- '`props.dangerouslySetInnerHTML`.'
791
+ 'menuitem is a void element tag and must neither have `children` nor use ' +
792
+ '`dangerouslySetInnerHTML`.'
793
);
794
795
});
@@ -943,8 +943,8 @@ describe('ReactDOMComponent', function() {
943
expect(function() {
944
ReactDOM.render(<X />, container);
945
}).toThrowError(
946
- 'input is a void element tag and must not have `children` ' +
947
- 'or use `props.dangerouslySetInnerHTML`. Check the render method of X.'
946
+ 'input is a void element tag and must neither have `children` ' +
947
+ 'nor use `dangerouslySetInnerHTML`. Check the render method of X.'
948
);
949
});
950
@@ -973,8 +973,8 @@ describe('ReactDOMComponent', function() {
973
expect(function() {
974
ReactDOM.render(<input>children</input>, container);
975
}).toThrowError(
976
- 'input is a void element tag and must not have `children` or use ' +
977
- '`props.dangerouslySetInnerHTML`.'
976
+ 'input is a void element tag and must neither have `children` nor use ' +
977
+ '`dangerouslySetInnerHTML`.'
978
);
979
});
980
@@ -987,8 +987,8 @@ describe('ReactDOMComponent', function() {
987
container
988
);
989
}).toThrowError(
990
- 'input is a void element tag and must not have `children` or use ' +
991
- '`props.dangerouslySetInnerHTML`.'
990
+ 'input is a void element tag and must neither have `children` nor use ' +
991
+ '`dangerouslySetInnerHTML`.'
992
);
993
});
994