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

Fix noSpaceAfterFlags support

This commit is contained in:
Bogdan Chadkin
2021-03-04 13:15:36 +03:00
parent be28d65d78
commit 0e02fd9fde
3 changed files with 43 additions and 8 deletions

View File

@ -63,8 +63,8 @@ describe('parse path data', () => {
l 50,-25
a25,25 -30 0,1 50,-25
25,50 -30 0,1 50,-25
25,75 -30 0,1 50,-25
a25,100 -30 0,1 50,-25
25,75 -30 01.2,-25
a25,100 -30 0150,-25
l 50,-25
`
)
@ -73,7 +73,7 @@ describe('parse path data', () => {
{ command: 'l', args: [50, -25] },
{ command: 'a', args: [25, 25, -30, 0, 1, 50, -25] },
{ command: 'a', args: [25, 50, -30, 0, 1, 50, -25] },
{ command: 'a', args: [25, 75, -30, 0, 1, 50, -25] },
{ command: 'a', args: [25, 75, -30, 0, 1, 0.2, -25] },
{ command: 'a', args: [25, 100, -30, 0, 1, 50, -25] },
{ command: 'l', args: [50, -25] },
]);
@ -163,4 +163,23 @@ describe('stringify path data', () => {
})
).to.equal('M0-2 0 3 100 200');
});
it('allows to avoid spaces after arc flags', () => {
const pathData = [
{ command: 'M', args: [0, 0] },
{ command: 'A', args: [50, 50, 10, 1, 0, 0.2, 20] },
{ command: 'a', args: [50, 50, 10, 1, 0, 0.2, 20] },
];
expect(
stringifyPathData({
pathData,
disableSpaceAfterFlags: false,
})
).to.equal('M0 0A50 50 10 1 0 .2 20a50 50 10 1 0 .2 20');
expect(
stringifyPathData({
pathData,
disableSpaceAfterFlags: true,
})
).to.equal('M0 0A50 50 10 10.2 20a50 50 10 10.2 20');
});
});