-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add new usePopoverShouldClose hook #1629
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1629 +/- ##
=======================================
Coverage 99.90% 99.90%
=======================================
Files 61 62 +1
Lines 1066 1071 +5
Branches 408 409 +1
=======================================
+ Hits 1065 1070 +5
Misses 1 1 ☔ View full report in Codecov by Sentry. |
37398db
to
1f232eb
Compare
1f232eb
to
4c92369
Compare
assert.calledWith( | ||
fakeUseClickAway, | ||
sinon.match.any, | ||
closeHandler, | ||
options ?? {}, | ||
); | ||
assert.calledWith( | ||
fakeUseFocusAway, | ||
sinon.match.any, | ||
closeHandler, | ||
options ?? {}, | ||
); | ||
assert.calledWith( | ||
fakeUseKeyPress, | ||
['Escape'], | ||
closeHandler, | ||
options ?? {}, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just mocking the other hooks and verifying they are called, as those hooks have their own tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but don't forget to export this along with the other hook exports.
Oh, good catch! I was about to test these changes in client, I guess I would have realized it was not exported then 😅 |
Sounds good. Let's move forward and do that soon. |
I thought I was merging something else 🤦🏼 Now I need to create another PR to export the symbol 😅 |
This PR adds a convenient
usePopoverShouldClose
hook which is similar to the deprecateduseElementShouldClose
, but internally combinesuseClickAway
,useFocusAway
anduseKeyPress
to make sure there's no implementation differences.It also provides a more contextual name that makes it clear in which cases is supposed to be used, as opposed to the cases in which some of the other three individual hooks should be used instead.