Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Commit

Permalink
checking if !th in thead.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonblanchard committed Nov 19, 2016
1 parent 4b2cc37 commit 4fdfeec
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions build/reactable.js
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ window.ReactDOM["default"] = window.ReactDOM;
var columns = [];
_react['default'].Children.forEach(component.props.children, function (th) {
var column = {};
if (!th) return;
if (typeof th.props !== 'undefined') {
column.props = (0, _libFilter_props_from.filterPropsFrom)(th.props);

Expand Down
1 change: 1 addition & 0 deletions lib/reactable/thead.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ var Thead = (function (_React$Component) {
var columns = [];
_react2['default'].Children.forEach(component.props.children, function (th) {
var column = {};
if (!th) return;
if (typeof th.props !== 'undefined') {
column.props = (0, _libFilter_props_from.filterPropsFrom)(th.props);

Expand Down
1 change: 1 addition & 0 deletions src/reactable/thead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export class Thead extends React.Component {
let columns = [];
React.Children.forEach(component.props.children, th => {
var column = {};
if (!th) return;
if (typeof th.props !== 'undefined') {
column.props = filterPropsFrom(th.props);

Expand Down
20 changes: 20 additions & 0 deletions tests/reactable_test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,26 @@ describe('Reactable', function() {
ReactableTestUtils.expectRowText(1, ['', '28', 'Developer']);
});
});

context("when one of the <Th>s is null", function(){
before(function () {
ReactDOM.render(
<Reactable.Table className="table" id="table">
<Reactable.Thead>
<Reactable.Th>Test</Reactable.Th>
{null}
</Reactable.Thead>
</Reactable.Table>,
ReactableTestUtils.testNode()
);
});

after(ReactableTestUtils.resetTestEnvironment);

it('renders the table', function() {
expect($('table#table.table')).to.exist;
});
});
});

describe('Adding a <Tfoot>', function() {
Expand Down

0 comments on commit 4fdfeec

Please sign in to comment.