Skip to content

Image - support SVG from uri #1712

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

Merged
merged 1 commit into from
Dec 8, 2021
Merged

Conversation

M-i-k-e-l
Copy link
Collaborator

Description

Image - support SVG from uri
Ticket number: 2328

Changelog

Image - support SVG from uri

@@ -38,6 +40,13 @@ enum SizeType {
Percentage = '50%'
}

enum SvgType {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this enum should be exported from the 'SvgImage' component... You can also use it in the component by first determining the source type and the have a switch case to the return instead of many 'if' statements - will be way cleaner

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be in the SvgImage, the user does not need to be aware of these different types, I'm not sure if it's "wrong" to put the different type here or not, perhaps I should add some tests though.
Regarding the single return, generally I agree with it, but it is a matter of taste, and I feel like it is fine the way it is currently (since the type is not coming from the component).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's your call

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, I tried to add some tests, but:

  1. There is no onLoad \ onError props in the SVG components.
  2. Snapshot tests have issues as well: some random things fail them (not sure how to mock these), might need to mock timers etc.
  3. Lastly I tried to use the (old method) of snapshot testing using react-test-renderer, again it did not work for me, since the remote images need to load somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants