File tree Expand file tree Collapse file tree 4 files changed +45
-19
lines changed Expand file tree Collapse file tree 4 files changed +45
-19
lines changed Original file line number Diff line number Diff line change @@ -1381,10 +1381,12 @@ window.ReactDOM["default"] = window.ReactDOM;
13811381
13821382 var firstChild = null ;
13831383
1384- if ( this . props . children && this . props . children . length > 0 && this . props . children [ 0 ] . type === _thead . Thead ) {
1385- firstChild = this . props . children [ 0 ] ;
1386- } else if ( typeof this . props . children !== 'undefined' && this . props . children . type === _thead . Thead ) {
1387- firstChild = this . props . children ;
1384+ if ( this . props . children ) {
1385+ if ( this . props . children . length > 0 && this . props . children [ 0 ] && this . props . children [ 0 ] . type === _thead . Thead ) {
1386+ firstChild = this . props . children [ 0 ] ;
1387+ } else if ( this . props . children . type === _thead . Thead ) {
1388+ firstChild = this . props . children ;
1389+ }
13881390 }
13891391
13901392 if ( firstChild !== null ) {
Original file line number Diff line number Diff line change @@ -408,10 +408,12 @@ var Table = (function (_React$Component) {
408408
409409 var firstChild = null ;
410410
411- if ( this . props . children && this . props . children . length > 0 && this . props . children [ 0 ] . type === _thead . Thead ) {
412- firstChild = this . props . children [ 0 ] ;
413- } else if ( typeof this . props . children !== 'undefined' && this . props . children . type === _thead . Thead ) {
414- firstChild = this . props . children ;
411+ if ( this . props . children ) {
412+ if ( this . props . children . length > 0 && this . props . children [ 0 ] && this . props . children [ 0 ] . type === _thead . Thead ) {
413+ firstChild = this . props . children [ 0 ] ;
414+ } else if ( this . props . children . type === _thead . Thead ) {
415+ firstChild = this . props . children ;
416+ }
415417 }
416418
417419 if ( firstChild !== null ) {
Original file line number Diff line number Diff line change @@ -362,17 +362,19 @@ export class Table extends React.Component {
362362
363363 let firstChild = null ;
364364
365- if (
366- this . props . children &&
367- this . props . children . length > 0 &&
368- this . props . children [ 0 ] . type === Thead
369- ) {
370- firstChild = this . props . children [ 0 ]
371- } else if (
372- typeof this . props . children !== 'undefined' &&
373- this . props . children . type === Thead
374- ) {
375- firstChild = this . props . children
365+
366+ if ( this . props . children ) {
367+ if (
368+ this . props . children . length > 0 &&
369+ this . props . children [ 0 ] &&
370+ this . props . children [ 0 ] . type === Thead
371+ ) {
372+ firstChild = this . props . children [ 0 ]
373+ } else if (
374+ this . props . children . type === Thead
375+ ) {
376+ firstChild = this . props . children
377+ }
376378 }
377379
378380 if ( firstChild !== null ) {
Original file line number Diff line number Diff line change @@ -33,6 +33,26 @@ var ReactableTestUtils = {
3333} ;
3434
3535describe ( 'Reactable' , function ( ) {
36+ describe ( "with null children" , function ( ) {
37+ before ( function ( ) {
38+ ReactDOM . render (
39+ < Reactable . Table className = "table" id = "table" >
40+ { null }
41+ { null }
42+ { null }
43+ </ Reactable . Table > ,
44+ ReactableTestUtils . testNode ( )
45+ ) ;
46+ } ) ;
47+
48+ after ( ReactableTestUtils . resetTestEnvironment ) ;
49+
50+ it ( 'renders the table' , function ( ) {
51+ expect ( $ ( 'table#table.table' ) ) . to . exist ;
52+ } ) ;
53+
54+ } ) ;
55+
3656 describe ( 'directly passing a data array' , function ( ) {
3757 before ( function ( ) {
3858 ReactDOM . render (
You can’t perform that action at this time.
0 commit comments