Skip to content
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

DSD-1121: SVG testing update #1710

Merged
merged 12 commits into from
Dec 18, 2024
Merged

DSD-1121: SVG testing update #1710

merged 12 commits into from
Dec 18, 2024

Conversation

7emansell
Copy link
Collaborator

@7emansell 7emansell commented Dec 5, 2024

Fixes JIRA ticket DSD-1121

This PR does the following:

  • Adds jest-transformer-svg package
  • Updates component tests to use the new data-file-name prop generated in the SVG mock (closest we can get to testing that the correct icon is being displayed)
    • Icon, Logo, SocialMediaLinks, Banner

How has this been tested?

  • Tested a release candidate in Turbine, no reason to expect this would change anything there, but all tests passed and SVGs displayed as expected locally

Accessibility concerns or updates

Accessibility Checklist

  • Checked Storybook's "Accessibility" tab for color contrast and other issues.
  • The feature works with keyboard inputs including tabbing back and forward and pressing space, enter, arrow, and esc keys.
  • For hidden text or when aria-live is used, a screenreader was used to verify the text is read.
  • For features that involve UI updates and focusing on DOM refs, focus management was reviewed.
  • The feature works when the page is zoomed in to 200% and 400%.

Open Questions

Checklist:

  • I have updated the Storybook documentation and changelog accordingly.
  • I have added relevant accessibility documentation for this pull request.
  • All new and existing tests passed.

Front End Review:

  • Review the Vercel preview deployment once it is ready.

Copy link

vercel bot commented Dec 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nypl-design-system ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 3:17pm

@7emansell 7emansell added the In Progress Tickets or PRs that are being worked on. PRs marked as In Progress should not be merged. label Dec 5, 2024
@7emansell 7emansell removed the In Progress Tickets or PRs that are being worked on. PRs marked as In Progress should not be merged. label Dec 6, 2024
Copy link
Member

@EdwinGuzman EdwinGuzman left a comment

Choose a reason for hiding this comment

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

Great, thanks! Was this package always installed so you didn't have to add it to package.json?

I don't think all components need to test the SVGs they render, but I think more components can use the data-file-name confirmation test. For example, Accordion could use it but that's not needed for MultiSelect or FilterBarInline because those use Accordions internally. It's not necessary for this PR since it wasn't requested to update all tests, but we should aim to update other component tests later on.

@7emansell
Copy link
Collaborator Author

Great, thanks! Was this package always installed so you didn't have to add it to package.json?

I think so, but since we were including svg in the list of elements for fileMock.ts, it wasn't being used.

I don't think all components need to test the SVGs they render, but I think more components can use the data-file-name confirmation test. For example, Accordion could use it but that's not needed for MultiSelect or FilterBarInline because those use Accordions internally. It's not necessary for this PR since it wasn't requested to update all tests, but we should aim to update other component tests later on.

Added Accordion test. I think it's definitely within the scope of this PR to update the tests but I guess by the same token, full coverage of the Icon component makes any tests we would do on Accordion, SocialMediaLinks, etc., redundant since they're using Icon internally. @EdwinGuzman

@EdwinGuzman
Copy link
Member

Yes, I'm also thinking about whether we should just write tests or if they're redundant since the Icon is already tested. I'm ok with what is already written.

@7emansell 7emansell added the Needs Review Pull requests that are ready for peer review. label Dec 10, 2024
@EdwinGuzman EdwinGuzman merged commit 5c8e5a0 into development Dec 18, 2024
5 checks passed
@bigfishdesign13 bigfishdesign13 removed the Needs Review Pull requests that are ready for peer review. label Dec 19, 2024
@bigfishdesign13 bigfishdesign13 added the Ship It Pull requests that have been reviewed and approved. label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ship It Pull requests that have been reviewed and approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants