Skip to content

Commit

Permalink
feat (Dropdown) close dropdown when item is selected [Fixes #118443355]
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Dzoan <ddzoan@pivotal.io>
  • Loading branch information
d-reinhold authored and Dan Dzoan committed Apr 27, 2016
1 parent 431ac0d commit ed3c6c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions library/spec/pivotal-ui-react/dropdown/dropdown_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ describe('Dropdowns', () => {
expect('.open .dropdown-menu').not.toExist();
});

it('hides when a menu item is selected', () => {
$('.dropdown-toggle').simulate('click');
expect('.open .dropdown-menu').toExist();
$('li:contains(Item #1)').simulate('click');
expect('.open .dropdown-menu').not.toExist();
});

describe('when scrim is disabled', () => {
it('does not hide the dropdown menu when clicking outside of the dropdown', () => {
subject::setProps({disableScrim: true});
Expand Down
2 changes: 1 addition & 1 deletion library/src/pivotal-ui-react/dropdowns/dropdowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Dropdown extends mixin(React.Component).with(Scrim) {
<div className={dropdownClasses}>
{dropdownLabel}
{dropdownToggle}
<ul className={dropdownMenuClasses}>{children}</ul>
<ul className={dropdownMenuClasses} onClick={this.scrimClick}>{children}</ul>
</div>
);
};
Expand Down

0 comments on commit ed3c6c5

Please sign in to comment.