-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix for opaque keyframes as object values #1414
Conversation
💥 No ChangesetLatest commit: e45ae4e Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂 If these changes should be published to npm, you need to add a changeset. Click here to learn what changesets are, and how to add one. |
) | ||
} | ||
}, | ||
'object with animationName and string keyframes as value': { |
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.
this is a test covering previously uncovered (but working) situation
@@ -32,7 +32,7 @@ let processStyleValue = ( | |||
case 'animation': | |||
case 'animationName': { | |||
if (typeof value === 'string') { | |||
value = value.replace(animationRegex, (match, p1, p2) => { | |||
return value.replace(animationRegex, (match, p1, p2) => { |
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.
just a short circuit
Codecov Report
|
6de7aec
to
d846ede
Compare
)}}` | ||
) | ||
switch (key) { | ||
case 'animation': |
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.
This case will never happen and because of that, let's change this to an if (key === 'animationName') else
packages/core/__tests__/keyframes.js
Outdated
return ( | ||
<div | ||
css={{ | ||
animation |
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.
This won't do anything, you need to at least also specify the duration of the animation. (hence the previous comment)
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.
I can add animationDuration here to reflect better real-world scenario (EDIT: done), but unfortunately animation can contain just an animation name and it's a valid CSS:
https://codesandbox.io/s/sad-cookies-oj0wk
d846ede
to
e45ae4e
Compare
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.
Thanks!!
fixes #1259
Let's discuss the fix first, going to add changeset later.