-
Notifications
You must be signed in to change notification settings - Fork 34
WIP feat(#2478): add work side menu component #2485
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
| import { fireEvent, render, waitFor } from "@testing-library/svelte"; | ||
| import WorkSideMenuWrapper from "./WorkSideMenuWrapper.test.svelte"; | ||
|
|
||
| describe("WorkSideMenu", () => { |
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.
I couldn't figure out how to test changing the current menu item. Whenever I clicked a menu item, the test couldn't see the change. I have two guesses of what may be going on:
- The test is happening before all the async events resolve
- The component events aren't properly firing in the test environment
There may be an easy fix. I'm sure a dev with better async testing experience could help here.
|
Cross-browser tested in the latest version of...
I tested the following in each browser:
|
adcca61 to
420cc95
Compare
| function addMenuLink(e: Event) { | ||
| let el = e.target as Element; | ||
| let link = el?.shadowRoot.querySelector("a"); | ||
| if (isDuplicateLink(link)) { |
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.
I've added a function that checks for links with duplicate hrefs in the menu. If one is found, then it skips the link and creates a console warning.
This assumes that there is no valid use case for having a duplicate href in your menu.
1a69e17 to
cf45350
Compare
|
I rebuilt this PR with the latest version on |
This PR adds the work side menu component.
work.side.menu.mp4
To do
How to test
Add one of the following menus to your playground:
Empty menu
Menu with primary, secondary, and account items
Menu with primary , secondary, account items, and badges
A full example with a sub menu