import { describe, expect, it } from 'vitest';
import { Group, loadSVGFromString, Polygon } from '../../../fabric';
import { groupSVGElements } from './groupSVGElements';
const SVG_WITH_1_ELEMENT =
'\
\
';
const SVG_WITH_2_ELEMENTS =
'\
\
';
describe('groupSVGElements', () => {
describe('groupSVGElements', () => {
it('returns the element when only one SVG element is provided', async () => {
const { objects, options } = await loadSVGFromString(SVG_WITH_1_ELEMENT);
// @ts-expect-error -- TODO: objects can also be array of nulls?
const group1 = groupSVGElements(objects, options);
expect(group1 instanceof Polygon).toBeTruthy();
});
it('returns a Group when multiple SVG elements are provided', async () => {
const { objects, options } = await loadSVGFromString(SVG_WITH_2_ELEMENTS);
// @ts-expect-error -- TODO: objects can also be array of nulls?
const group2 = groupSVGElements(objects, options);
expect(group2).toBeInstanceOf(Group);
});
});
});