-
Notifications
You must be signed in to change notification settings - Fork 359
Add validateUserInput for client-side validation #3089
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
base: main
Are you sure you want to change the base?
Conversation
🗄️ Schema Change: No Changes ✅ |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (79d2b77) and published it to npm. You Example: pnpm add @khanacademy/perseus@PR3089If you are working in Khan Academy's frontend, you can run the below command. ./dev/tools/bump_perseus_version.ts -t PR3089If you are working in Khan Academy's webapp, you can run the below command. ./dev/tools/bump_perseus_version.js -t PR3089 |
|
Size Change: +102 B (+0.02%) Total Size: 499 kB
ℹ️ View Unchanged
|
🛠️ Item Splitting: No Changes ✅ |
…serInput function to perseus-score
| import {scorePerseusItem, scoreWidgetsFunctional} from "./score"; | ||
| import {getExpressionWidget, getTestDropdownWidget} from "./util/test-helpers"; | ||
|
|
||
| describe("flattenScores", () => { |
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.
Moved
| * `PerseusWidgetsMap` or ` into any function that accepts a | ||
| * `ValidationDataMap` without any mutation of data. | ||
| */ | ||
| export type ValidationDataMap = { |
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 didn't see the point of having this type and it was keeping me from reusing helpers between scoring and validation logic. Ideally in the future we could just have a AnswerfulPerseusItem and AnswerlessPerseusItem or something.
| * If a widget says that it is empty once it is graded. | ||
| * Trying to encapsulate references to the score format. | ||
| */ | ||
| export function scoreIsEmpty(score: PerseusScore): boolean { |
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.
Moved a bunch of these helpers into their own files.
Summary:
We had
scorePerseusItemwhich validates/scores with an answerful PerseusItem and we hademptyWidgetsFunctionalwhich checks for "emptiness" with an answerless PerseusItem, but we didn't have a helper that did full client-side validation which we'll need before we can removescorePerseusItem(and answerful PerseusItems) from the client.Issue: LEMS-3731