-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mock Widget for cleaning up Tests (#2072)
## Summary: This work was done as part of the Numeric Input project. This PR introduces a new Mock Widget to be used for any tests that doesn't require testing the capabilities of a specific widget. I have updated as many tests and/or testdatas as I could find, except for a few key situations: - The test requires that we test a specific widget, such as extract-perseus-data. (Although I would like to recommend that we break up and move these tests into the individual widget tests as all we need to do is import a single function.) - The testdata is being used for storybook I have also updated as many occurrences of any remaining uses of `input-number `in our tests to `numeric-input`, in order to help smooth the path forward for the eventual return to the Input Number Conversion project. I have opted not to include the widget in our extra-widgets / general registration for now as it would require that I also create an editor for it, but a caveat of this approach means that this widget is not accessible for Webapp tests. I would be happy to hear any thoughts regarding this approach, as I wasn't sure if I should be globally registering this widget. Issue: LEMS-2615 ## Test plan: - ensure all tests pass Author: SonicScrewdriver Reviewers: SonicScrewdriver, jeremywiebe, mark-fitzgerald Required Reviewers: Approved By: jeremywiebe, mark-fitzgerald Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x) Pull Request URL: #2072
- Loading branch information
1 parent
bbf7f3b
commit 6cf6477
Showing
30 changed files
with
726 additions
and
561 deletions.
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,8 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
"@khanacademy/perseus-core": patch | ||
"@khanacademy/perseus-editor": patch | ||
"@khanacademy/pure-markdown": patch | ||
--- | ||
|
||
The creation of a new Mock Widget for tests. |
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
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
30 changes: 0 additions & 30 deletions
30
packages/perseus-editor/src/__testdata__/input-number.testdata.ts
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
packages/perseus-editor/src/__testdata__/numeric-input.testdata.ts
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,34 @@ | ||
import type {PerseusRenderer} from "@khanacademy/perseus-core"; | ||
|
||
export const question1: PerseusRenderer = { | ||
content: | ||
"A sequence is defined recursively as follows:\n\n\n$\\qquad\\displaystyle{{a}_{n}}=-\\frac{1}{a_{n-1}-1} \n~~~~~~\\text{ with}\\qquad\\displaystyle{{a}_{0}}=\\frac{1}{2}\\,$\n\n\nFind the term $a_3$ in the sequence.\n\n[[\u2603 numeric-input 1]]", | ||
images: {}, | ||
widgets: { | ||
"numeric-input 1": { | ||
graded: true, | ||
version: { | ||
major: 0, | ||
minor: 0, | ||
}, | ||
static: false, | ||
type: "numeric-input", | ||
options: { | ||
coefficient: false, | ||
static: false, | ||
answers: [ | ||
{ | ||
status: "correct", | ||
maxError: null, | ||
strict: false, | ||
value: 0.5, | ||
simplify: "required", | ||
message: "", | ||
}, | ||
], | ||
labelText: "What's the answer?", | ||
size: "normal", | ||
}, | ||
}, | ||
}, | ||
}; |
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
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
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
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
Oops, something went wrong.