Skip to content

Commit

Permalink
[fixed] Handle falsey DropdownMenu children correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Aug 28, 2015
1 parent 6a8ed3e commit 478300a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import keycode from 'keycode';
import classNames from 'classnames';
import RootCloseWrapper from 'react-overlays/lib/RootCloseWrapper';

import ValidComponentChildren from './utils/ValidComponentChildren';
import createChainedFunction from './utils/createChainedFunction';

class DropdownMenu extends React.Component {
Expand Down Expand Up @@ -77,7 +77,7 @@ class DropdownMenu extends React.Component {
}

render() {
const items = React.Children.map(this.props.children, child => {
const items = ValidComponentChildren.map(this.props.children, child => {
let {
children,
onKeyDown,
Expand Down
9 changes: 9 additions & 0 deletions test/DropdownMenuSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ describe('DropdownMenu', function() {
node.className.should.match(/\bdropdown-menu-right\b/);
});

it('handles empty children', function() {
ReactTestUtils.renderIntoDocument(
<DropdownMenu pullRight>
<MenuItem>Item</MenuItem>
{ false && <MenuItem>Item 2</MenuItem> }
</DropdownMenu>
);
});

describe('focusable state', function() {
let focusableContainer;

Expand Down

0 comments on commit 478300a

Please sign in to comment.