Skip to content

Commit

Permalink
Switch to use numeric-input instead of input-number (deprecated) for …
Browse files Browse the repository at this point in the history
…unit tests
  • Loading branch information
jeremywiebe committed Dec 13, 2024
1 parent 9a18ac0 commit d978f9e
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 80 deletions.
32 changes: 21 additions & 11 deletions packages/perseus/src/__testdata__/renderer.testdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type {
DropdownWidget,
ImageWidget,
InputNumberWidget,
NumericInputWidget,
PerseusRenderer,
} from "../perseus-types";
import type {RenderProps} from "../widgets/radio";
Expand Down Expand Up @@ -49,22 +50,31 @@ export const imageWidget: ImageWidget = {
version: {major: 0, minor: 0},
};

export const inputNumberWidget: InputNumberWidget = {
export const numericInputWidget: NumericInputWidget = {
graded: true,
version: {
major: 0,
minor: 0,
},
type: "input-number",
graded: true,
alignment: "default",
static: false,
type: "numeric-input",
options: {
maxError: 0.1,
inexact: false,
value: 0.3333333333333333,
simplify: "optional",
answerType: "rational",
coefficient: false,
static: false,
answers: [
{
status: "correct",
maxError: null,
strict: false,
value: 1252,
simplify: "required",
message: "",
},
],
labelText: "",
size: "normal",
},
alignment: "default",
};

export const question1: PerseusRenderer = {
Expand All @@ -76,15 +86,15 @@ export const question1: PerseusRenderer = {

export const question2: PerseusRenderer = {
content:
"Denis baked a peach pie and cut it into $3$ equal-sized pieces. Denis's dad eats $1$ section of the pie. \n\n**What fraction of the pie did Denis's dad eat?** \n![](https://ka-perseus-graphie.s3.amazonaws.com/74a2b7583a2c26ebfb3ad714e29867541253fc97.png) \n[[\u2603 input-number 1]] \n\n\n\n",
"Denis baked a peach pie and cut it into $3$ equal-sized pieces. Denis's dad eats $1$ section of the pie. \n\n**What fraction of the pie did Denis's dad eat?** \n![](https://ka-perseus-graphie.s3.amazonaws.com/74a2b7583a2c26ebfb3ad714e29867541253fc97.png) \n[[\u2603 numeric-input 1]] \n\n\n\n",
images: {
"https://ka-perseus-graphie.s3.amazonaws.com/74a2b7583a2c26ebfb3ad714e29867541253fc97.png":
{
width: 200,
height: 200,
},
},
widgets: {"input-number 1": inputNumberWidget},
widgets: {"numeric-input 1": numericInputWidget},
};

export const definitionItem: PerseusRenderer = {
Expand Down
12 changes: 6 additions & 6 deletions packages/perseus/src/__tests__/perseus-markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe("perseus markdown", () => {
],
},
{
content: "[[☃ test 1]]+[[☃ input-number 2]]",
content: "[[☃ test 1]]+[[☃ numeric-input 2]]",
expected: [
{
type: "paragraph",
Expand All @@ -314,15 +314,15 @@ describe("perseus markdown", () => {
},
{
type: "widget",
widgetType: "input-number",
id: "input-number 2",
widgetType: "numeric-input",
id: "numeric-input 2",
},
],
},
],
},
{
content: "*[[☃ test 2]]* [[☃ input-number 1]]",
content: "*[[☃ test 2]]* [[☃ numeric-input 1]]",
expected: [
{
type: "paragraph",
Expand All @@ -343,8 +343,8 @@ describe("perseus markdown", () => {
},
{
type: "widget",
widgetType: "input-number",
id: "input-number 1",
widgetType: "numeric-input",
id: "numeric-input 1",
},
],
},
Expand Down
Loading

0 comments on commit d978f9e

Please sign in to comment.