2
0
mirror of https://github.com/iconify/iconify.git synced 2024-09-19 00:39:02 +00:00

chore: test parsing SVG with nested SVG

This commit is contained in:
Vjacheslav Trushkin 2023-08-18 14:39:38 +03:00
parent 2446ff51c6
commit 63462d9ddb

View File

@ -188,4 +188,35 @@ describe('Testing parsing SVG content', () => {
};
expect(built).toEqual(expected);
});
test('Nested SVG', () => {
const body = `<circle cx="50" cy="50" r="40" />
<circle cx="150" cy="50" r="4" />
<svg viewBox="0 0 10 10" x="200" width="100">
<circle cx="5" cy="5" r="4" />
</svg>`;
const parsed = parseSVGContent(`<svg
viewBox="0 0 300 100"
xmlns="http://www.w3.org/2000/svg"
stroke="red"
fill="grey">
${body}
</svg>
`);
expect(parsed).toBeTruthy();
if (!parsed) {
return;
}
expect(parsed.attribs).toEqual({
viewBox: '0 0 300 100',
xmlns: 'http://www.w3.org/2000/svg',
stroke: 'red',
fill: 'grey',
});
expect(parsed.body).toEqual(body);
});
});