-
Notifications
You must be signed in to change notification settings - Fork 39
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
Refactoring image selector components #149
Conversation
Merge to stay up to date
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.
Hey @evazhog, the PR fails one of our tests (specifically it's one on the profile panel image selector, which makes sense) - do you mind fixing the test to use the new structure of the image selector?
Other than that, this looks generically good; I'll give it a more thorough look over in a moment.
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.
Overall the functionality looks good, but left a bit of review in terms of possible app structure ideas.
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.
Hey Evan, thanks for taking the time to sit down with me and work through on this ticket! We figured out (some) of the issues with the broken tests, moved around some code, and added some constants.
Just to recap, a few things that need to be done for the rest of the ticket:
- write an
ImageSelector.scss
file that contains all the styling forImageSelector.js
- ideally, we want no leakage from other styles (in case they change in the future) - write an
ImageSelector.test.js
file that tests the component by itself- write a smoke test: check that the component renders shallow-ly
- write some props tests: check that the component handles each of its props properly. edge-cases aren't too important here, but make sure that you cover the generic inputs they'll receive (especially because usually we pass in variables to these components, instead of literals)
- bonus: write some mouse-event simulator tests: selecting each element and checking the state change, checking if clicking the button triggers the function (you can look into mock jest functions for this), etc. you can look at other test files and see how they do this
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.
Just for sake of clarity: all of the necessary refactoring is done, great job @evazhog! Waiting on possible extra tests for the custom component, but at the current state this LGTM.
Just checking in, @evazhog, are you planning on adding any tests to your refactor? If not, I am happy to merge this and write tests after the fact. Just wanted to follow up as this PR has been in limbo for a while now. |
Plan on taking another pass at it tomorrow, can't get to it tonight unfortunately. |
No worries Evan! Just wanted to check in. Take it easy! |
On account of core functionality being OK, I'll be going ahead and merging this. Seeing as this component favors integration tests, we can always add them down the line. Thanks for all your work Evan! |
Profile Picture Selector
Edit Sketch Selector
Create Sketch Selector
Props to be passed into ImageSelector components:
isOpen
: boolean for whether the modal is opencloseModal
: callback for when the modal is closedicons
: array of elements for icons to displaymaxWidth
: optional limit on the width of the modalthumbnailPreview
: optional image element to display on the header showing what icon the user has currently selectederror
: optional error statechildren
: optional footer buttons