Skip to content

Commit

Permalink
Add failing test on animation with keyframe value that looks like hex…
Browse files Browse the repository at this point in the history
… with unit

Add failing test on animation with keyframe value that looks like hex with unit
  • Loading branch information
SkReD committed Aug 24, 2020
1 parent 434e34d commit 29936e6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/postcss-convert-values/package.json
Expand Up @@ -28,7 +28,7 @@
"repository": "cssnano/cssnano",
"dependencies": {
"postcss": "^7.0.16",
"postcss-value-parser": "^3.3.1"
"postcss-value-parser": "^4.1.0"
},
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
Expand Down
7 changes: 7 additions & 0 deletions packages/postcss-convert-values/src/__tests__/index.js
Expand Up @@ -377,6 +377,13 @@ test(
passthroughCSS('h1{top:0\\9\\0;left:0lightyear}')
);

test(
'should not try to convert keyframe names in animation',
passthroughCSS(
'h1{ -webkit-animation: e836684w2 } h2{ animation: e836684w2 }'
)
);

['stroke-dasharray', 'stroke-dashoffset', 'stroke-width'].forEach(
(property) => {
test(
Expand Down
7 changes: 6 additions & 1 deletion packages/postcss-convert-values/src/index.js
Expand Up @@ -24,7 +24,12 @@ function parseWord(node, opts, keepZeroUnit) {
const pair = unit(node.value);
if (pair) {
const num = Number(pair.number);
const u = pair.unit;
let u = pair.unit;

if (u[0] === '.') {
u = u.slice(1);
}

if (num === 0) {
node.value =
keepZeroUnit || (!~LENGTH_UNITS.indexOf(u.toLowerCase()) && u !== '%')
Expand Down
8 changes: 4 additions & 4 deletions packages/postcss-convert-values/yarn.lock
Expand Up @@ -40,10 +40,10 @@ has-flag@^3.0.0:
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=

postcss-value-parser@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281"
integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==
postcss-value-parser@^4.1.0:
version "4.1.0"
resolved "https://nexus-new.tcsbank.ru/repository/npm-all/postcss-value-parser/-/postcss-value-parser-4.1.0.tgz#443f6a20ced6481a2bda4fa8532a6e55d789a2cb"
integrity sha512-97DXOFbQJhk71ne5/Mt6cOu6yxsSfM0QGQyl0L25Gca4yGWEGJaig7l7gbCX623VqTBNGLRLaVUCnNkcedlRSQ==

postcss@^7.0.16:
version "7.0.27"
Expand Down

0 comments on commit 29936e6

Please sign in to comment.