-
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.
Remove ItemRenderer and ProvideKeypad (#833)
## Summary: Removing dead code Issue: LC-1317 Author: handeyeco Reviewers: jeremywiebe Required Reviewers: Approved By: jeremywiebe Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage, ✅ gerald, ⏭ Publish npm snapshot, ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 16.x), ✅ Extract i18n strings (ubuntu-latest, 16.x), ✅ Cypress (ubuntu-latest, 16.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 16.x), ✅ Check builds for changes in size (ubuntu-latest, 16.x), ✅ Jest Coverage (ubuntu-latest, 16.x), ✅ gerald, ✅ Check for .changeset entries for all changed files (ubuntu-latest, 16.x) Pull Request URL: #833
- Loading branch information
Showing
14 changed files
with
191 additions
and
2,260 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,5 @@ | ||
--- | ||
"@khanacademy/perseus": major | ||
--- | ||
|
||
Remove export of ItemRenderer |
30 changes: 0 additions & 30 deletions
30
packages/perseus/src/__stories__/item-renderer.stories.tsx
This file was deleted.
Oops, something went wrong.
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
299 changes: 0 additions & 299 deletions
299
packages/perseus/src/__testdata__/item-renderer.testdata.ts
This file was deleted.
Oops, something went wrong.
160 changes: 160 additions & 0 deletions
160
packages/perseus/src/__testdata__/server-item-renderer.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,160 @@ | ||
import type { | ||
InputNumberWidget, | ||
LabelImageWidget, | ||
PerseusItem, | ||
PerseusRenderer, | ||
} from "../perseus-types"; | ||
|
||
export const itemWithInput: PerseusItem = { | ||
question: { | ||
content: | ||
"Enter the number $$-42$$ in the box: [[\u2603 input-number 1]]", | ||
images: {}, | ||
widgets: { | ||
"input-number 1": { | ||
type: "input-number", | ||
graded: true, | ||
options: { | ||
answerType: "number", | ||
value: "-42", | ||
simplify: "required", | ||
size: "normal", | ||
inexact: false, | ||
maxError: 0.1, | ||
}, | ||
} as InputNumberWidget, | ||
}, | ||
}, | ||
hints: [ | ||
{content: "Hint #1", images: {}, widgets: {}}, | ||
{content: "Hint #2", images: {}, widgets: {}}, | ||
{content: "Hint #3", images: {}, widgets: {}}, | ||
], | ||
answerArea: null, | ||
_multi: null, | ||
itemDataVersion: {major: 0, minor: 0}, | ||
answer: null, | ||
}; | ||
|
||
export const labelImageItem: PerseusItem = { | ||
answerArea: { | ||
calculator: false, | ||
chi2Table: false, | ||
periodicTable: false, | ||
tTable: false, | ||
zTable: false, | ||
}, | ||
_multi: null, | ||
answer: null, | ||
hints: [], | ||
itemDataVersion: {major: 0, minor: 1}, | ||
question: { | ||
content: | ||
"Catherine created a chart and a bar graph to show how many dogs of each breed the animal shelter placed into good homes last year. \n\nDog breed | Number of dogs \n:- | :-: \nBulldog | $32$ \nGreyhound | $72$ \nMastiff | $56$ \nCollie | $40$ \n\n**Label each bar on the bar graph.**\n\n[[☃ label-image 1]]\n\n\n\n", | ||
images: { | ||
"web+graphie://ka-perseus-graphie.s3.amazonaws.com/2f60b533892fe6cb9351f704ffdada8ae4bc655c": | ||
{height: 365, width: 503}, | ||
"web+graphie://ka-perseus-graphie.s3.amazonaws.com/75f937c6ea133d655dd9f698a58182efd6cc85d4": | ||
{height: 293, width: 331}, | ||
}, | ||
widgets: { | ||
"label-image 1": { | ||
alignment: "default", | ||
graded: true, | ||
static: false, | ||
type: "label-image", | ||
version: {major: 0, minor: 0}, | ||
options: { | ||
choices: ["Bulldog", "Greyhound", "Mastiff", "Collie"], | ||
hideChoicesFromInstructions: true, | ||
imageAlt: | ||
"A bar graph with four bar lines shows the horizontal axis labeled Dog breed and the vertical axis labeled Number of dogs. The vertical axis is labeled from the bottom of the axis to the top of the axis as follows: 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, and 80. The horizontal axis has, from left to right, four unlabeled bar lines as follows: the first unlabeled bar line extends to 56, the second unlabeled bar line extends to 72, the third unlabeled bar line extends to 40, and the fourth unlabeled bar line extends to 32.", | ||
imageHeight: 293, | ||
imageUrl: | ||
"web+graphie://ka-perseus-graphie.s3.amazonaws.com/64ace45942546183c3dc842cb0e9e4f64a312727", | ||
imageWidth: 331, | ||
markers: [ | ||
{ | ||
answers: ["Bulldog"], | ||
label: "The fourth unlabeled bar line.", | ||
x: 87.3, | ||
y: 90.2, | ||
}, | ||
{ | ||
answers: ["Collie"], | ||
label: "The third unlabeled bar line.", | ||
x: 67.7, | ||
y: 90.5, | ||
}, | ||
{ | ||
answers: ["Greyhound"], | ||
label: "The second unlabeled bar line.", | ||
x: 47.7, | ||
y: 90.2, | ||
}, | ||
{ | ||
answers: ["Mastiff"], | ||
label: "The first unlabeled bar line.", | ||
x: 27.8, | ||
y: 90.5, | ||
}, | ||
], | ||
multipleAnswers: false, | ||
static: false, | ||
}, | ||
} as LabelImageWidget, | ||
}, | ||
}, | ||
}; | ||
|
||
// Note that if this item is used, you _must_ first register the MockWidget | ||
export const mockedItem: PerseusItem = { | ||
// The mock widget type is not part of the PerseusWidget type union (and | ||
// we don't want to make it such to avoid polluting our production types | ||
// for test purposes) so we force TypeScript to accept it here. | ||
// @ts-expect-error - TS2352 - Conversion of type '{ content: string; images: {}; widgets: { "mock-widget 1": { graded: true; version: { major: number; minor: number; }; static: false; type: "mock-widget"; options: { static: false; smiling: boolean; }; alignment: string; }; "mock-widget 2": { ...; }; "mock-widget 3": { ...; }; "mock-widget 4": { ...; }; }; }' to type 'PerseusRenderer' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. | ||
question: { | ||
content: | ||
"Mock widget ==> [[\u2603 mock-widget 1]] [[\u2603 mock-widget 2]] [[\u2603 mock-widget 3]] [[\u2603 mock-widget 4]]", | ||
images: {}, | ||
widgets: { | ||
"mock-widget 1": { | ||
graded: true, | ||
version: {major: 0, minor: 0}, | ||
static: false, | ||
type: "mock-widget", | ||
options: {static: false, smiling: true}, | ||
alignment: "default", | ||
}, | ||
"mock-widget 2": { | ||
graded: true, | ||
version: {major: 0, minor: 0}, | ||
static: false, | ||
type: "mock-widget", | ||
options: {static: false, smiling: false}, | ||
alignment: "default", | ||
}, | ||
"mock-widget 3": { | ||
graded: true, | ||
version: {major: 0, minor: 0}, | ||
static: false, | ||
type: "mock-widget", | ||
options: {static: false, smiling: true}, | ||
alignment: "default", | ||
}, | ||
"mock-widget 4": { | ||
graded: true, | ||
version: {major: 0, minor: 0}, | ||
static: false, | ||
type: "mock-widget", | ||
options: {static: false, smiling: false}, | ||
alignment: "default", | ||
}, | ||
}, | ||
} as PerseusRenderer, | ||
hints: [], | ||
answerArea: null, | ||
_multi: null, | ||
itemDataVersion: {major: 0, minor: 0}, | ||
answer: null, | ||
}; |
Oops, something went wrong.