mirror of
https://github.com/svg/svgo.git
synced 2025-07-29 20:21:14 +03:00
Simplify number rendering and fix -0 in path
Ref https://github.com/svg/svgo/issues/1422
This commit is contained in:
@ -142,26 +142,24 @@ describe('stringify path data', () => {
|
||||
).to.equal('M0-1.2.3 4 5-.6 7 .8');
|
||||
});
|
||||
it('should configure precision', () => {
|
||||
const pathData = [
|
||||
{ command: 'M', args: [0, -1.9876] },
|
||||
{ command: 'L', args: [0.3, 3.14159265] },
|
||||
{ command: 'L', args: [-0.3, -3.14159265] },
|
||||
{ command: 'L', args: [100, 200] },
|
||||
];
|
||||
expect(
|
||||
stringifyPathData({
|
||||
pathData: [
|
||||
{ command: 'M', args: [0, -1.9876] },
|
||||
{ command: 'L', args: [0.3, 3.14159265] },
|
||||
{ command: 'L', args: [100, 200] },
|
||||
],
|
||||
pathData,
|
||||
precision: 3,
|
||||
})
|
||||
).to.equal('M0-1.988.3 3.142 100 200');
|
||||
).to.equal('M0-1.988.3 3.142-.3-3.142 100 200');
|
||||
expect(
|
||||
stringifyPathData({
|
||||
pathData: [
|
||||
{ command: 'M', args: [0, -1.9876] },
|
||||
{ command: 'L', args: [0.3, 3.14159265] },
|
||||
{ command: 'L', args: [100, 200] },
|
||||
],
|
||||
pathData,
|
||||
precision: 0,
|
||||
})
|
||||
).to.equal('M0-2 0 3 100 200');
|
||||
).to.equal('M0-2 0 3 0-3 100 200');
|
||||
});
|
||||
it('allows to avoid spaces after arc flags', () => {
|
||||
const pathData = [
|
||||
|
Reference in New Issue
Block a user