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

Enhance internal state control by providing onOuterClick prop #208

Merged
merged 1 commit into from Oct 4, 2017
Merged

Enhance internal state control by providing onOuterClick prop #208

merged 1 commit into from Oct 4, 2017

Commits on Oct 4, 2017

  1. Enhance internal state control by providing onOuterClick prop

    This PR is not ready to be merged yet. When merged, this will fix #206
    
    This PR does the following (Will appreciate early feedback and comments):-
    
    1. Add onOuterClick description to README. I can remove the link to a specific issue from there
    
    2. Add onOuterClick to propTypes with type PropTypes.func
    
    3. Call this.props.onOuterClick as a callback to reset function when it is called under onMouseUp event
    
    4. Add a test case for newly added functionality. This is still incomplete. I started with the test case expecting it to fail in its current state where I open the menu and simulate a outside click with click on document.body. With the current state of the onOuterClick callback this should have resulted in isOpen to be false there by failing the test but it is not the case. Exploring.
    
    Also, to simulate the click on document.body. I borrowed the function `mouseDownAndUp` from `downshift.lifecycle.js`. I can either move this test over there or expose that function in a better way than duplicating.
    
    Let me know your feedback on the approach? Also, please point out if you believe that I understood the problem incorrectly.
    Divyendu Singh authored and Kent C. Dodds committed Oct 4, 2017
    Copy the full SHA
    83646b6 View commit details
    Browse the repository at this point in the history