Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #340 from plotly/allow-tabs-null-children
Browse files Browse the repository at this point in the history
Allow tabs null children
  • Loading branch information
rmarren1 authored Oct 19, 2018
2 parents a776958 + 85f99f3 commit 639c826
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dash_core_components/dash_core_components.dev.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_core_components/dash_core_components.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/Tabs.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default class Tabs extends Component {

const children = this.parseChildrenToArray();
let value;
if (children[0].props.children) {
if (children && children[0].props.children) {
value = children[0].props.children.props.value || 'tab-1';
} else {
value = 'tab-1';
Expand Down
8 changes: 8 additions & 0 deletions test/unit/Tabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,11 @@ describe('Tabs can be used 2 ways', () => {
expect(tabs.state().selected).toEqual('custom-tab-1');
});
});
describe('Tabs can have null children', () => {
test('Try to create a Tabs with null children', () => {
mount(
<Tabs id="tabs">
</Tabs>
);
});
});

0 comments on commit 639c826

Please sign in to comment.