-
Notifications
You must be signed in to change notification settings - Fork 351
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
Refactor the cs-program widget to use a getUserInput function #1697
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a738fc3
Refactor to add and use getUserInput
Myranae 781ec03
Add changeset
Myranae c5a6af1
Add test for cs-program's getUserInput
Myranae 7ab373f
Remove test and remove getUserInputFromProps
Myranae 32483a3
Remove unneeded export
Myranae 1123d43
Remove unneeded import
Myranae 8be3e30
Add tests for getUserInput
Myranae bb14421
Remove duplicate test
Myranae 6dea81a
Merge branch 'main' into tb/LEMS-2459/getUserInputFunc-for-cs-program
Myranae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
--- | ||
|
||
Refactor cs-program to use a getUserInputFunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I wonder if we need the
getUserInputFromProps
method?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.
Ooo, for sure. I think I was just following the framework for other widgets that use
getUserInput
; it seems like most of them use this method. Maybe leave this for now and have a ticket to go through and refactor outgetUserInputFromProps
from as many widgets as possible? I'm not sure I understand why they were there in the first place. Looks like the method might be used in tests 🤔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.
Okay, so first I kept the method and set up a test with it. I was following the example from categorizer's test. But then I tried to use the example from group's test and realized that cs-program uses an iframe. Checking out iframe, it doesn't have a
getUserInputFromProps
method, and it does it the way you suggest here. So I just did it this way in the end XD Not sure how to add a test though since iframe doesn't have any tests forgetUserInput
either. Do you have any suggestions @handeyeco ? (Also, I just picked up the ticket to split out validation logic from iframe, so we'll see if doing that first gives ideas here)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.
Yeah, I don't really know. Maybe something like:
I wouldn't lose sleep on it. We'll probably need to add tests to all the widgets for this and this could be a part of that process.