UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

18 lines (16 loc) 627 B
import { cleanupSvgAttribute } from './cleanupSvgAttribute'; import { expect, it, describe } from 'vitest'; describe('cleanupSvgAttribute', () => { it('add space around a single number', () => { const cleaned = cleanupSvgAttribute('1'); expect(cleaned).toBe(' 1 '); }); it('replace multiple spaces with a single one', () => { const cleaned = cleanupSvgAttribute(' 1 '); expect(cleaned).toBe(' 1 '); }); it('replace commas with spaces or commas and multiple spaces with a single space', () => { const cleaned = cleanupSvgAttribute('1,2 , 4'); expect(cleaned).toBe(' 1 2 4 '); }); });