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

fix(Dropdown): stop onOpen from firing twice on icon click #2744

Merged
merged 2 commits into from
Apr 27, 2018

Conversation

willb335
Copy link
Contributor

Connects #2600

onOpen is firing twice when Dropdown icon is clicked with a search prop

The change is at line 426. The other changes are from Prettier

@welcome
Copy link

welcome bot commented Apr 26, 2018

💖 Thanks for opening this pull request! 💖

Here is a list of things that will help get it across the finish line:

  • Run yarn lint locally to catch formatting errors. This will fix some errors automatically, commit and push any changes.
  • Run yarn test locally to catch errors. This ensures all components still behave as they should.
  • Run yarn start to run the doc site locally and try a few pages, ensuring everything is in good working order.
  • Include tests when adding/changing behavior.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@codecov-io
Copy link

codecov-io commented Apr 26, 2018

Codecov Report

Merging #2744 into master will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2744      +/-   ##
==========================================
+ Coverage   99.67%   99.74%   +0.07%     
==========================================
  Files         160      160              
  Lines        2761     2759       -2     
==========================================
  Hits         2752     2752              
+ Misses          9        7       -2
Impacted Files Coverage Δ
src/modules/Dropdown/Dropdown.js 100% <100%> (ø) ⬆️
src/modules/Search/Search.js 99.46% <0%> (+1.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e55c7d...97957f9. Read the comment docs.

@levithomason
Copy link
Member

Great fix, thanks!

Let's also get a test that asserts the callback is .calledOnce(). You can find tests in Dropdown-test.js. We describe() tests by prop, so look for describe('onOpen', ...) (around line 1280).

There are many examples of using .calledOnce in the file you can refer to. We only need one test saying that it('is called once when the icon is clicked', ...). It would also be superb to leave a comment link to the GitHub issue there.

@willb335
Copy link
Contributor Author

The new test in Dropdown-test.js starts at line 1249. The new test fails as expected without the changes in the first commit.

@levithomason levithomason merged commit cc7d9ee into Semantic-Org:master Apr 27, 2018
@levithomason
Copy link
Member

Thanks!

@willb335 willb335 deleted the fix/dropdown-onopen branch April 27, 2018 17:20
@levithomason
Copy link
Member

Released in [email protected].

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.

3 participants