-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Prevent expanding/collapsing a notification when clicking the action button #48074
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
content: action.content, | ||
onClick: event => { | ||
// Prevents toggling the isExpanded flag. | ||
event.stopPropagation(); |
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 any way we can add a test for this? It's a rather niche interaction that can easily regress in the future. OTOH, as isExpanded
merely controls the styles, I don't think the JSDOM-based tests are going to be able to detect the difference.
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.
Yeah, we can't detect the text overflow. Instead, I added a test that checks if the style wasn't modified by the click. What do you think?
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.
That should be good enough for now! I didn't realize that toHaveStyleRule
works with CSS in general, I've always assumed it only works when the style is set directly on a node.
Clicking on the action button should not expand/collapse notifications:
notification.mov