Skip to content

Commit

Permalink
Revert "Fixing issue with Input Numbers that have a value of 0 (#1888)"
Browse files Browse the repository at this point in the history
This reverts commit d0e7a03.
  • Loading branch information
SonicScrewdriver committed Nov 22, 2024
1 parent adad642 commit 9a00cd7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {ServerItemRendererWithDebugUI} from "../../../../testing/server-item-ren
import {storybookDependenciesV2} from "../../../../testing/test-dependencies";
import {
itemWithInput,
itemWithInputNumber,
itemWithLintingError,
labelImageItem,
itemWithImages,
Expand All @@ -28,10 +27,6 @@ export const NumericInputItem = (args: StoryArgs): React.ReactElement => {
return <ServerItemRendererWithDebugUI item={itemWithInput} />;
};

export const InputNumberItem = (args: StoryArgs): React.ReactElement => {
return <ServerItemRendererWithDebugUI item={itemWithInputNumber} />;
};

export const LabelImageItem = (args: StoryArgs): React.ReactElement => {
return <ServerItemRendererWithDebugUI item={labelImageItem} />;
};
Expand Down
32 changes: 0 additions & 32 deletions packages/perseus/src/__testdata__/server-item-renderer.testdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
type ExpressionWidget,
type RadioWidget,
type NumericInputWidget,
type InputNumberWidget,
} from "../perseus-types";

export const itemWithInput: PerseusItem = {
Expand Down Expand Up @@ -49,37 +48,6 @@ export const itemWithInput: PerseusItem = {
answer: null,
};

export const itemWithInputNumber: 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: {
static: false,
value: 0,
simplify: "required",
maxError: 0.1,
inexact: false,
answerType: "number",
size: "small",
},
} as InputNumberWidget,
},
},
hints: [
{content: "Hint #1", images: {}, widgets: {}},
{content: "Hint #2", images: {}, widgets: {}},
{content: "Hint #3", images: {}, widgets: {}},
],
answerArea: null,
itemDataVersion: {major: 0, minor: 0},
answer: null,
};

export const itemWithMultipleNumericInputs: PerseusItem = {
question: {
content:
Expand Down
4 changes: 2 additions & 2 deletions packages/perseus/src/widgets/numeric-input/numeric-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,10 @@ const propsTransform = function (
const propUpgrades = {
/* c8 ignore next */
"1": (initialProps: any): PerseusNumericInputWidgetOptions => {
// If the initialProps has simplify, it means we're upgrading from
// If the initialProps has a value, it means we're upgrading from
// input-number to numeric-input. In this case, we need to upgrade
// the widget options accordingly.
if (initialProps.simplify !== undefined) {
if (initialProps.value) {
// If the answerType is not number or percent, we need to provide
// the answer form for the numeric-input widget
const provideAnswerForm =
Expand Down

0 comments on commit 9a00cd7

Please sign in to comment.