-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[unit-test]: overflow menu #17875
[unit-test]: overflow menu #17875
Conversation
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17875 +/- ##
==========================================
+ Coverage 82.29% 82.64% +0.34%
==========================================
Files 404 404
Lines 14303 14298 -5
Branches 4605 4605
==========================================
+ Hits 11771 11816 +45
+ Misses 2368 2321 -47
+ Partials 164 161 -3 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Hey @divya-281, thanks for opening that PR!! 🚀 |
@guidari I was able to increase to 74% |
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.
This is looking good, thanks for taking it on!
Looking at the coverage report, a few ideas to get this to 80%:
- Test that pressing escape closes the menu
- Find the path to get
this.closeMenuAndFocus();
to be called. The steps to reproduce this bug could be helpful, as the fix was within the final condition before it's called. I think the assertion would be that the menu closed and focus returned to the trigger element.
carbon/packages/react/src/components/OverflowMenu/OverflowMenu.tsx
Lines 585 to 593 in 796f838
if ( | |
!menuBody.contains(target) && | |
triggerEl && | |
!target.matches( | |
`.${this.context}--overflow-menu:first-child,.${this.context}--overflow-menu-options:first-child` | |
) | |
) { | |
this.closeMenuAndFocus(); | |
} |
@tay1orjones @guidari I added a test to check if the menu closes when pressing the esc key |
@tay1orjones @guidari Thanks for the suggestions, I was able to get the coverage upto 80%. |
Thank you @divya-281 |
I only see bottom and top here, Can you let me know when the case left and right is triggered? Am I missing something? |
Hey @divya-281 Interesting catch! I was taking a look in the code and seems like the |
@guidari I've commented those lines |
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, thanks!
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.
Thank you @divya-281
69a81ab
increases test coverage for overflow menu
#17499