-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(Icon): correct prepareStringData #1096
Conversation
Preview is ready. |
it('should remove width and height only inside svg tag', () => { | ||
const data = | ||
'<svg width="100" viewBox="0 0 200 200" height="200">\n<rect x="50" y="50" width="100" height="100" fill="red" />\n</svg>'; | ||
expect(prepareStringData(data)).toEqual( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.toBe
is more straightforward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.toBe
is specifically useful for reference equality, for string comparison there is no difference here
@@ -22,7 +22,12 @@ export function isStringSvgData(data: SVGIconData): data is SVGIconStringData { | |||
return typeof data === 'string'; | |||
} | |||
export function prepareStringData(data: SVGIconStringData) { | |||
return data.replace(/(width|height)=(["']?)\d+\2/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should keep the same logic for quotes
No description provided.