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

feat: add showCloseOnHover option for toast component & fix test error #548

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

viiccwen
Copy link

Summary

This PR introduces a new showCloseOnHover option for toasts, enhancing user interaction flexibility, and also fixes an existing test case for improved reliability.

New Feature

  • showCloseOnHover Option:
    • Added a new showCloseOnHover option to the toast component.
    • Behavior:
      • When showCloseOnHover is false or unspecified, the toast behaves normally with the close button always visible.
      • When showCloseOnHover is true, the close button becomes visible only when the user hovers over the toast.

Test Fix

  • Fixed the toast is not removed when hovered test case:
    • Updated the test to initialize the page with the correct state by navigating to /?position=top-left.
    • Simulated user interaction (click and hover) to test the new behavior properly.
    • Ensured the toast remains visible after a 5-second hover period.

References

Testing

  • Verified that the showCloseOnHover option behaves as expected in different scenarios:
    • Close button always visible when showCloseOnHover is false or unspecified.
    • Close button only appears on hover when showCloseOnHover is true.
  • Ensured existing tests pass and updated test coverage for the new functionality.

Please review the changes and share your feedback! 🚀

Copy link

vercel bot commented Jan 26, 2025

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

Name Status Preview Comments Updated (UTC)
sonner ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 26, 2025 4:15pm

@viiccwen viiccwen changed the title feat: add showCloseOnHover option for toast component & fix test error feat: add showCloseOnHover option for toast component & fix test error (#546) Jan 26, 2025
@viiccwen viiccwen changed the title feat: add showCloseOnHover option for toast component & fix test error (#546) feat: add showCloseOnHover option for toast component & fix test error Jan 26, 2025
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.

1 participant