File tree 4 files changed +45
-19
lines changed
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;
1381
1381
1382
1382
var firstChild = null ;
1383
1383
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
+ }
1388
1390
}
1389
1391
1390
1392
if ( firstChild !== null ) {
Original file line number Diff line number Diff line change @@ -408,10 +408,12 @@ var Table = (function (_React$Component) {
408
408
409
409
var firstChild = null ;
410
410
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
+ }
415
417
}
416
418
417
419
if ( firstChild !== null ) {
Original file line number Diff line number Diff line change @@ -362,17 +362,19 @@ export class Table extends React.Component {
362
362
363
363
let firstChild = null ;
364
364
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
+ }
376
378
}
377
379
378
380
if ( firstChild !== null ) {
Original file line number Diff line number Diff line change @@ -33,6 +33,26 @@ var ReactableTestUtils = {
33
33
} ;
34
34
35
35
describe ( '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
+
36
56
describe ( 'directly passing a data array' , function ( ) {
37
57
before ( function ( ) {
38
58
ReactDOM . render (
You can’t perform that action at this time.
0 commit comments