-
Notifications
You must be signed in to change notification settings - Fork 25
test: add unit tests for context menu drop #826
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
Conversation
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.
Pull Request Overview
This PR adds comprehensive unit tests for context menu drop functionality and refactors the related components to support the new drop-menu API.
- Snapshots for
ContextActionMenuandActionMenuDropItemupdated to include nested drop menus. - Tests migrated from
shallowMounttomountand prop renamed tomenuSectionDrop. - Component code refactored: prop renames, ID and class adjustments, and removal of unused imports.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/web-pkg/tests/unit/components/ContextActions/ContextActionMenu.spec.ts | Switched to mount, updated test cases and snapshots to cover drop menus. |
| packages/web-pkg/tests/unit/components/ContextActions/ActionMenuDropItem.spec.ts | New tests for drop-item rendering and empty-state behavior. |
| packages/web-pkg/src/composables/actions/files/useFileActionsNavigate.ts | Changed the user-facing label from “Open folder” to “Open”. |
| packages/web-pkg/src/components/ContextActions/ContextActionMenu.vue | Prop for drop component renamed to menu-section-drop. |
| packages/web-pkg/src/components/ContextActions/ActionMenuItem.vue | Removed unused useGettext import. |
| packages/web-pkg/src/components/ContextActions/ActionMenuDropItem.vue | Renamed props to menuSectionDrop, updated HTML ID generation logic, empty-state class, and iteration keys. |
Comments suppressed due to low confidence (3)
packages/web-pkg/tests/unit/components/ContextActions/ContextActionMenu.spec.ts:17
- The new empty-state behavior (
renderOnEmpty) is tested inActionMenuDropItembut not inContextActionMenu. Consider adding a test case in this spec to verify that empty-drop sections render the empty message correctly.
it('renders the menu with drop menu items', async () => {
packages/web-pkg/src/components/ContextActions/ActionMenuDropItem.vue:4
- Generating HTML IDs from the dynamic
labelcan lead to invalid or unstable IDs (e.g., spaces, translated text). Consider using a stable property such assection.nameor a sanitized slug for the ID.
:id="`oc-files-context-actions-${menuSectionDrop.label}-toggle`"
packages/web-pkg/src/composables/actions/files/useFileActionsNavigate.ts:43
- [nitpick] Changing the label from 'Open folder' to 'Open' may affect user expectations and translation keys. Ensure all translation resources are updated and any documentation or UI guidelines reflect this change.
label: () => $gettext('Open'),
298fddd to
50e09d7
Compare
|
@JammingBen this also fixed:
|
c02e7ba to
06d29ec
Compare
| export type MenuSectionDrop = { | ||
| label: string | ||
| name: string |
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 for e2e tests
401f451 to
d1faf45
Compare
| return isTouchDevice() ? 'click' : 'mouseenter focus' | ||
| } | ||
| return mode | ||
| return ( |
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.
Reverted to original
72d7f25 to
74bb39b
Compare
74bb39b to
fbc3b47
Compare
JammingBen
left a comment
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.
🏅
* test: add unit tests for context menu drop * simplify check if click event is on nestedToggleEvent * don't close nested drop when click on toggle item
Description
Related Issue
How Has This Been Tested?
Types of changes