mirror of
https://github.com/feathericons/feather.git
synced 2023-08-10 21:13:24 +03:00
build: Add process-svgs script (#216)
This commit is contained in:
26
bin/__tests__/__snapshots__/process-svg.test.js.snap
Normal file
26
bin/__tests__/__snapshots__/process-svg.test.js.snap
Normal file
@ -0,0 +1,26 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`processes SVG correctly 1`] = `
|
||||
"<svg
|
||||
xmlns=\\"http://www.w3.org/2000/svg\\"
|
||||
width=\\"24\\"
|
||||
height=\\"24\\"
|
||||
viewBox=\\"0 0 24 24\\"
|
||||
fill=\\"none\\"
|
||||
stroke=\\"currentColor\\"
|
||||
stroke-width=\\"2\\"
|
||||
stroke-linecap=\\"round\\"
|
||||
stroke-linejoin=\\"round\\"
|
||||
>
|
||||
<line x1=\\"23\\" y1=\\"1\\" x2=\\"1\\" y2=\\"23\\" />
|
||||
<line x1=\\"1\\" y1=\\"1\\" x2=\\"23\\" y2=\\"23\\" />
|
||||
</svg>
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`rejects when passed unparsable SVG string 1`] = `
|
||||
[Error: Error in parsing SVG: Unclosed root tag
|
||||
Line: 0
|
||||
Column: 10
|
||||
Char: ]
|
||||
`;
|
15
bin/__tests__/process-svg.test.js
Normal file
15
bin/__tests__/process-svg.test.js
Normal file
@ -0,0 +1,15 @@
|
||||
/* eslint-env jest */
|
||||
import processSvg from '../process-svg';
|
||||
|
||||
test('processes SVG correctly', () => {
|
||||
const SVG =
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><title>Title</title><line x1="23" y1="1" x2="1" y2="23" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><line x1="1" y1="1" x2="23" y2="23" fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/></svg>';
|
||||
|
||||
expect(processSvg(SVG)).resolves.toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('rejects when passed unparsable SVG string', () => {
|
||||
const UNPARSABLE_SVG = '<svg></svg';
|
||||
|
||||
expect(processSvg(UNPARSABLE_SVG)).rejects.toMatchSnapshot();
|
||||
});
|
Reference in New Issue
Block a user