Skip to content

refactor(breadcrumbs): use menu over deprecated buttondropdown #1646

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

Merged
merged 4 commits into from
Jun 5, 2023

Conversation

jinlee93
Copy link
Contributor

@jinlee93 jinlee93 commented Jun 1, 2023

EFI-1002

Summary:

Test Plan:

  • Manually tested my changes, and here are the details:
    • Ellipsis breadcrumbs works with the links in Storybook

@jinlee93 jinlee93 requested a review from a team June 1, 2023 23:23
@github-actions
Copy link

github-actions bot commented Jun 1, 2023

size-limit report 📦

Path Size
components 94.99 KB (-0.02% 🔽)
styles 36.4 KB (-0.07% 🔽)

@codecov
Copy link

codecov bot commented Jun 2, 2023

Codecov Report

Merging #1646 (1c565c3) into next (0e505a9) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             next    #1646   +/-   ##
=======================================
  Coverage   93.29%   93.29%           
=======================================
  Files         222      222           
  Lines        2955     2955           
  Branches      717      717           
=======================================
  Hits         2757     2757           
  Misses        181      181           
  Partials       17       17           
Impacted Files Coverage Δ
src/components/Breadcrumbs/Breadcrumbs.tsx 93.61% <100.00%> (ø)
src/components/BreadcrumbsItem/BreadcrumbsItem.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -133,5 +133,6 @@ export const LongTextMenu: StoryObj<Args> = {
const canvas = within(canvasElement);
const dropdownMenuTrigger = await canvas.findByRole('button');
userEvent.click(dropdownMenuTrigger);
// TODO: capture open menu in Chromatic
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this change broke the capturing of the open Menu state in Chromatic, tried the following to avail:

  • await new Promise((resolve) => setTimeout(resolve, 300)); in the play function to wait for loading
  • delay: 500 in the story chromatic properties to wait before snapping

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend looking at this one for comparison: https://github.com/chanzuckerberg/edu-design-system/blob/main/src/components/Menu/Menu.test.tsx#L22-L40

You might need to use an await on the click? Or we could migrate this test to a unit test to match up with the other Menu test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it snapped with the decorator padding

@booc0mtaco
Copy link
Contributor

@jinlee93 on the chromatic diffs, b/c the popout menu is not attached to the directly-adjacent DOM of the breadcrumb menu, it is clipping the menu from the snapshot. We can add a decorator which includes some bottom padding to show the menu

@jinlee93
Copy link
Contributor Author

jinlee93 commented Jun 2, 2023

@jinlee93 on the chromatic diffs, b/c the popout menu is not attached to the directly-adjacent DOM of the breadcrumb menu, it is clipping the menu from the snapshot. We can add a decorator which includes some bottom padding to show the menu

Looks like that was it. Will add some padding to ensure chromatic captures this... Think that resolves the need for a jest test since we're not trying to test the Menu functionality itself @booc0mtaco

@jinlee93 jinlee93 force-pushed the jlee/useMenuInBreadcrumbs branch from c49ba3c to 1c565c3 Compare June 2, 2023 22:14
@jinlee93 jinlee93 requested a review from booc0mtaco June 5, 2023 16:59
Copy link
Contributor

@booc0mtaco booc0mtaco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 🚢

@jinlee93 jinlee93 merged commit 637aaf2 into next Jun 5, 2023
@jinlee93 jinlee93 deleted the jlee/useMenuInBreadcrumbs branch June 5, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants