1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00

Ignore keyframes in computeStyle

Ref https://github.com/svg/svgo/issues/1408
This commit is contained in:
Bogdan Chadkin
2021-03-09 01:47:56 +03:00
parent aa803bc889
commit ddbd7046b2
2 changed files with 34 additions and 0 deletions

View File

@ -212,4 +212,35 @@ describe('computeStyle', () => {
});
expect(computeStyle(root.querySelector('#invalid-type'))).to.deep.equal({});
});
it('ignores keyframes atrule', () => {
const root = svg2js(`
<svg>
<style>
.a {
animation: loading 4s linear infinite;
}
@keyframes loading {
0% {
stroke-dashoffset: 440;
}
50% {
stroke-dashoffset: 0;
}
50.1% {
stroke-dashoffset: 880;
}
}
</style>
<rect id="element" class="a" />
</svg>
`);
expect(computeStyle(root.querySelector('#element'))).to.deep.equal({
animation: {
type: 'static',
inherited: false,
value: 'loading 4s linear infinite',
},
});
});
});