swisspost / design-system

The Swiss Post Design System pattern library for a consistent and accessible user experience across the web platform.
https://design-system.post.ch
Apache License 2.0
106 stars 13 forks source link

feat(components): tooltips #1879

Closed gfellerph closed 7 months ago

gfellerph commented 8 months ago

Adds a post-tooltip component.

changeset-bot[bot] commented 8 months ago

🦋 Changeset detected

Latest commit: 6a8bbeb2047cfcce6d3059e3d3db0c44630cb2fc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages | Name | Type | | ----------------------------------------- | ----- | | @swisspost/design-system-documentation | Minor | | @swisspost/design-system-components | Minor | | @swisspost/design-system-components-react | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

swisspost-bot commented 8 months ago

Preview environment ready: https://preview-1879--swisspost-design-system-next.netlify.app Preview environment ready: https://preview-1879--swisspost-design-system-next-v7.netlify.app

alizedebray commented 7 months ago
  • No snapshot tests: not sure how to test something that only shows up on user interaction

Probably something like:

cy.get('button[data-tooltip-target="tooltip"]', { timeout: 30000 }).should('be.visible'); // wait for page load
cy.get('button[data-tooltip-target="tooltip"]').focus();
cy.get('#tooltip').should('be.visible');
cy.percySnapshot('Alerts', { widths: [1440] });
sonarcloud[bot] commented 7 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

imagoiq commented 7 months ago

Thanks @alizedebray for the great review !

imagoiq commented 7 months ago
  • No snapshot tests: not sure how to test something that only shows up on user interaction

Probably something like:

cy.get('button[data-tooltip-target="tooltip"]', { timeout: 30000 }).should('be.visible'); // wait for page load
cy.get('button[data-tooltip-target="tooltip"]').focus();
cy.get('#tooltip').should('be.visible');
cy.percySnapshot('Alerts', { widths: [1440] });

You are right about the interaction, but I'll still avoid doing the snapshot tests as we are limited by the number of snapshots. In this case, we would need to make one snapshot per variant, as we cannot focus multiple elements at the same time.

sonarcloud[bot] commented 7 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication