Skip to content

Fix inappropriate modification of steps() function arguments #6

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

Merged
merged 1 commit into from
Jan 4, 2019
Merged

Conversation

smashercosmo
Copy link
Contributor

@smashercosmo smashercosmo commented Jan 3, 2019

This PR fixes the following issue:

input:

.foo { animation: spin 1s steps(12, end) infinite; }

output:

:local(.foo) { animation: :local(spin) 1s steps(12, :local(end)) infinite; }

steps() function arguments shouldn't be treated as identifiers

@codecov-io
Copy link

codecov-io commented Jan 3, 2019

Codecov Report

Merging #6 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
+ Coverage   99.57%   99.58%   +0.01%     
==========================================
  Files           2        2              
  Lines         234      243       +9     
  Branches       66       71       +5     
==========================================
+ Hits          233      242       +9     
  Misses          1        1
Impacted Files Coverage Δ
test.js 100% <ø> (ø) ⬆️
index.js 99.53% <100%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e9514c...095bbac. Read the comment docs.

@smashercosmo
Copy link
Contributor Author

Is double iteration of value nodes ok? If not, I can rewrite it with one iteration, via saving 'function' node in temp variable.

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, let's rewrite this in one function, it is better for perf

@smashercosmo
Copy link
Contributor Author

Done

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One note and we can merge this, thanks for job

index.js Outdated
const valueNodes = valueParser(decl.value).walk((node) => {
/* If div-token appeared (represents as comma ','), a possibility of an animation-keywords should be reflesh. */
if (node.type === 'div') {
parsedAnimationKeywords = {};
}
if (node.type === 'function' && node.value === 'steps') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

steps can be uppercased like STEPS()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please add test for STEPS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch)

@alexander-akait
Copy link
Member

Oh, start and end also can be uppercased, can we add tests for this to avoid future problems

@smashercosmo
Copy link
Contributor Author

Why does case matter for 'start' and 'end'?

@alexander-akait
Copy link
Member

alexander-akait commented Jan 4, 2019

@smashercosmo it is css spec, all words can be lowercase and uppercase and mixed cased, so will be great if we respect spec from w3

@smashercosmo
Copy link
Contributor Author

smashercosmo commented Jan 4, 2019

@evilebottnawi yeah, I understand that, but I mean, why does it matter for this particular case? We don't refer to 'end' or 'start' keywords by their names.

@alexander-akait
Copy link
Member

@smashercosmo hm, let's add tests for this case and if it is green we can merge this 👍

@smashercosmo
Copy link
Contributor Author

@evilebottnawi ok, done)

Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job! Will be released in near future

@alexander-akait alexander-akait merged commit 8fa1cd7 into css-modules:master Jan 4, 2019
@smashercosmo
Copy link
Contributor Author

Thx, I guess css-loader should also be updated

@alexander-akait
Copy link
Member

Fixed https://github.com/css-modules/postcss-modules-local-by-default/releases/tag/v2.0.4

css-loader will be release in near future

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.

3 participants