File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,19 @@ describe('props', () => {
5959 } ) ;
6060 } ) ;
6161
62+ it ( 'does not error if there are undefined children' , ( ) => {
63+ var undefChild ;
64+ doNotExpectWarning ( assertions . props . onClick . NO_LABEL . msg , ( ) => {
65+ < div onClick = { k } > { undefChild } bar</ div > ;
66+ } ) ;
67+ } ) ;
68+
69+ it ( 'does not error if there are null children' , ( ) => {
70+ doNotExpectWarning ( assertions . props . onClick . NO_LABEL . msg , ( ) => {
71+ < div onClick = { k } > bar { null } </ div > ;
72+ } ) ;
73+ } ) ;
74+
6275 it ( 'does not warn if there is an image with an alt attribute' , ( ) => {
6376 doNotExpectWarning ( assertions . props . onClick . NO_LABEL . msg , ( ) => {
6477 < div onClick = { k } > < img src = "#" alt = "Foo" /> </ div > ;
@@ -169,4 +182,3 @@ describe('tags', () => {
169182 } ) ;
170183 } ) ;
171184} ) ;
172-
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ var hasChildTextNode = (props, children) => {
2323 React . Children . forEach ( children , ( child ) => {
2424 if ( hasText )
2525 return ;
26+ else if ( child === null )
27+ return ;
28+ else if ( typeof child === 'undefined' )
29+ return ;
2630 else if ( typeof child === 'string' )
2731 hasText = true ;
2832 else if ( child . type === 'img' && child . props . alt )
@@ -108,4 +112,3 @@ exports.tags = {
108112 }
109113 }
110114} ;
111-
You can’t perform that action at this time.
0 commit comments