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

test(DefinitionTooltip): fix unit tests and add coverage for DefinitionTooltip #17679

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Neues
Copy link
Contributor

@Neues Neues commented Oct 8, 2024

Changed

  • add and fix unit tests around tooltip opening functionality (toBeVisible was not working as expected in this scenario, I am instead checking for the aria-expanded attribute).

* fix issue where initial click would open and immediately close tooltip
* fix unit tests around this functionality
@Neues Neues requested a review from a team as a code owner October 8, 2024 13:58
Copy link

netlify bot commented Oct 8, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit fe4d4df
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/67095523b501f8000894777b
😎 Deploy Preview https://deploy-preview-17679--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 8, 2024

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fe4d4df
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/670955239ef8e000075b358e
😎 Deploy Preview https://deploy-preview-17679--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ariellalgilmore
Copy link
Member

hi @Neues, thanks for the contribution! I believe this was already fixed with #17622

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.00%. Comparing base (694e71f) to head (fe4d4df).
Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17679      +/-   ##
==========================================
+ Coverage   78.33%   79.00%   +0.66%     
==========================================
  Files         408      408              
  Lines       14015    14008       -7     
  Branches     4344     4371      +27     
==========================================
+ Hits        10979    11067      +88     
+ Misses       2867     2774      -93     
+ Partials      169      167       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Neues Neues changed the title fix: definitiontooltip initial click issue test(DefinitionTooltip): fix unit tests and add coverage for DefinitionTooltip Oct 10, 2024
Copy link
Member

@ariellalgilmore ariellalgilmore left a comment

Choose a reason for hiding this comment

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

looking good! just some small comments

await userEvent.click(screen.getByText('URL'));
expect(screen.getByText(definition)).toBeVisible();
expect(screen.getByRole('button')).toHaveAttribute('aria-expanded', 'true');
Copy link
Member

Choose a reason for hiding this comment

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

wondering if we can keep the check toBeVisible along with checking if aria-expanded is true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was debating leaving it but ultimately decided to remove it like I removed the others for the reason that it does not actually work as expected in this case; toBeVisible() returns true even when the tooltip is not expanded. I replaced the other instances where it was being used, and then elected to remove this one so that other devs don't get confused.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah I've seen this before too, the aria-expanded does seem like the best workaround 👍

@Neues
Copy link
Contributor Author

Neues commented Oct 11, 2024

hi @Neues, thanks for the contribution! I believe this was already fixed with #17622

Sorry about this! I should've caught that, will try and be more mindful of duplicate issues open like this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants