-
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
[LEMS-2852] Answerless Expression #2226
base: main
Are you sure you want to change the base?
Conversation
Size Change: +137 B (+0.02%) Total Size: 871 kB
ℹ️ View Unchanged
|
"extraKeys": [ | ||
"PI", | ||
], |
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.
Maybe instead of having deriveExtraKeys
default to ["PI"]
it should just be empty and the props can default to ["PI"]
when rendering...
@@ -0,0 +1,77 @@ | |||
import * as KAS from "@khanacademy/kas"; |
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 just need to work with Jeremy to figure out this import stuff. There's a weird issue with a circular dependency that I wasn't able to figure out.
expect(score).toHaveBeenAnsweredCorrectly(); | ||
}); | ||
|
||
it("is interactive with answerless widget options", async () => { |
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.
This is the important one. Without answer data we:
- Render
- Answer
- Send the input off for scoring
* to be included as keys on the keypad. These are scraped from the answer | ||
* forms. | ||
*/ | ||
export const keypadConfigurationForProps = ( |
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.
Most of this logic was for deriving extra keys, so I just transformed this into deriveExtraKeys
.
buttonsVisible: v0options.buttonsVisible, | ||
visibleLabel: v0options.visibleLabel, | ||
ariaLabel: v0options.ariaLabel, | ||
extraKeys: v0options.extraKeys, |
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.
Remove this
extraKeys: v1options.extraKeys || deriveExtraKeys(v1options), | ||
}; | ||
}, | ||
"1": (v0options: any): PerseusExpressionWidgetOptions => { |
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.
This probably shouldn't return PerseusExpressionWidgetOptions
Summary:
So the main thing with the Expression widget is that it was using answer data to determine which
extraKeys
to show in theMathInput
keypad. For instance if a possible answer was42i
, it would showi
in theExtra
tab on the keypad.This PR sets us up for removing answers by adding
extraKeys
to the data schema so it can be determined at publish time rather than read time. We simulate this by upgrading the widget to provideextraKeys
when not present on the data.Issue: LEMS-2852
Test plan: