-
Notifications
You must be signed in to change notification settings - Fork 16
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
Toast: Prevent error being thrown if opened without returnElements setting #572
Toast: Prevent error being thrown if opened without returnElements setting #572
Conversation
The toaster element should be defaulting to an empty array if no returnElements is passed in.
If a custom event was fired without a returnElement, it was setting the private attribute to undefined. This would throw an error on toast close because it was not iterable.
🦋 Changeset detectedLatest commit: 793c910 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a test that could exercise the bug?
I updated the existing mock to not pass an explicit I changed the test first, saw it failing, made my change, saw it passing so I do think it is covering the changes. Not opposed to adding one though, if you think that would be better? |
That seems sufficient! |
…tting (ithaka#572) * test(toast): run tests with default returnElements The toaster element should be defaulting to an empty array if no returnElements is passed in. * fix(toast): ensure returnElements is defined If a custom event was fired without a returnElement, it was setting the private attribute to undefined. This would throw an error on toast close because it was not iterable. * docs: add @brentswisher as a contributor * chore(changelog): update changelog
This change: (check at least one)
Is this a breaking change? (check one)
Is the: (complete all)
What does this change address?
Fixes #571 by preventing the default toaster
returnElements
value from being overwritten toundefined
if a toast event is created without specifying it in thepharos-toast-open
event.How does this change work?
If the
returnElements
coming from the event details isundefined
it will be defaulted to an empty array