Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Dropdown): add closeOnChange prop #1252

Merged

Conversation

apiv
Copy link
Contributor

@apiv apiv commented Jan 30, 2017

fulfills issue #1244, adding a closeOnChange prop to Dropdown, with usage example added to the docs.

@apiv apiv force-pushed the feature/Dropdown-close-on-change branch from c41c2eb to a6443f8 Compare January 30, 2017 18:05
Copy link
Member

@levithomason levithomason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great so far, couple small nits and some tests will finish it up.

@@ -17,6 +17,12 @@ const DropdownUsageExamples = () => (
/>

<ComponentExample
title='Close On Change'
description='A multiselect can close when the user changes its value.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for consistency with the props, can we go with A multiple selection dropdown... here?

@@ -85,6 +85,9 @@ export default class Dropdown extends Component {
/** Whether or not the menu should close when the dropdown is blurred. */
closeOnBlur: PropTypes.bool,

/** Whether or not the menu should close when a value is selected from the dropdown */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the default is hidden from the user (logic based in the method) perhaps we should note the default here. Let's add the period to the end of this sentence while we're at it.

const { closeOnChange, multiple } = this.props
const shouldClose = _.isUndefined(closeOnChange)
? !multiple
: closeOnChange
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The false branch of this logic is untested, this is why Codecov is failing the PR:

image

tip: the coverage data overlayed here in GH is added by the Codecov extension

Even though the other branches are executed during tests, we don't actually have assertions for this new feature. We'll need a new describe('closeOnChange', ... ) block in the Dropdown-test.js where we can test this new prop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up, specs added, changes made and re-pushed

@apiv apiv force-pushed the feature/Dropdown-close-on-change branch from a6443f8 to 34165f8 Compare January 30, 2017 20:50
@apiv apiv force-pushed the feature/Dropdown-close-on-change branch from 34165f8 to bf6b0ba Compare January 30, 2017 20:52
@levithomason
Copy link
Member

Superb, thanks much! I'll release this within the hour.

@levithomason levithomason merged commit fa0b605 into Semantic-Org:master Jan 31, 2017
@levithomason
Copy link
Member

As promised, released in semantic-ui-react@0.64.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants