Skip to content

Conversation

@SonicScrewdriver
Copy link
Contributor

@SonicScrewdriver SonicScrewdriver commented Feb 6, 2025

Summary:

This is the Feature Branch for the Numeric Input Project.

This PR includes the following commits:

Test plan:

  • tests pass
  • lint passes
  • Passed a Full QA Regression Suite

@SonicScrewdriver SonicScrewdriver self-assigned this Feb 6, 2025
@SonicScrewdriver
Copy link
Contributor Author

Here is the Feature Testing Task for this pull-request: https://khanacademy.atlassian.net/browse/LEMS-2845

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2025

Size Change: -1.43 kB (-0.16%)

Total Size: 870 kB

Filename Size Change
packages/math-input/dist/es/index.js 78.2 kB +157 B (+0.2%)
packages/perseus-core/dist/es/index.js 29.7 kB +68 B (+0.23%)
packages/perseus-editor/dist/es/index.js 276 kB +4 B (0%)
packages/perseus-score/dist/es/index.js 20.6 kB +237 B (+1.17%)
packages/perseus/dist/es/index.js 366 kB -1.9 kB (-0.52%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 39.5 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 11.1 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-linter/dist/es/index.js 22.8 kB
packages/perseus/dist/es/strings.js 6.57 kB
packages/pure-markdown/dist/es/index.js 4.14 kB
packages/simple-markdown/dist/es/index.js 13.1 kB

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2025

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (86bb214) and published it to npm. You
can install it using the tag PR2209.

Example:

pnpm add @khanacademy/perseus@PR2209

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR2209

@SonicScrewdriver SonicScrewdriver marked this pull request as draft February 6, 2025 23:02
SonicScrewdriver and others added 13 commits February 13, 2025 15:02
We have a lot of old patterns in Perseus, and we would like to start to updating to more modern methods. This PR updates the Numeric Input logic in the following ways:

1. Moves all UI Related Numeric Input logic to a functional component, and creates a new `numeric-input.class.tsx` file for housing the static / class methods.
2. Removes all string refs related to Numeric Input in both the InputWithExamples, SimpleKeypadInput, and Tooltip components
3. Adds a little more specificity to method parameters

Issue: LEMS-2443

- Manual Testing
- Automated Tests
- Landing onto a feature branch for future QA Regression pass

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: 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 npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (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), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x)

Pull Request URL: #2108
This PR is part of the Numeric Input Project, and will be landed onto the feature branch for a full QA pass.

The intended goal was to remove all cases of underscore in the Numeric Input component, and to improve the commenting / documentation of the code.

Some things to note:
- I've changed the logic of `generateExamples` to match `shouldShowExamples`, as we were generating a list of all possible examples and simply not displaying it. This seemed unnecessary and we can exit both functions early.
- I've added more specific types for `PerseusNumericInputWidgetOptions.simplify`

Issue: LEMS-2446

- New tests
- Manual testing in storybook

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald, jeremywiebe

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x)

Pull Request URL: #2128
…er (#2121)

This PR is part of the Numeric Input Project work. It is being landed onto the `feature/numeric-dx-refactor` branch.

This PR contains the following changes:
1. Moves the InputWithExamples component to the NumericInput folder
2. Modernizes InputWithExamples to be a functional component
3. Addition of some comments

Video Example of Snapshot Testing:

https://github.com/user-attachments/assets/ca917778-50b0-46d2-89d8-dad95d1dadf2

Issue: LEMS-2785

- Ensure all tests pass
- Manual testing with PR Snapshot in upstream consumer
- Landing onto feature branch that will see full QA regression pass before deployment

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x)

Pull Request URL: #2121
This PR is part of the Numeric Input Project.

The purpose of this PR is to improve our storybook setup for our Numeric Input Widget. This includes the following work:
- Modernizing story structure
- Hooking up argTypes with descriptions
- Updating RendererWithDebugUI to also set customKeypad to the same value as isMobile
     - This allows us to ensure that our Widgets that use MathInput are properly updating when toggled into Mobile view
- Adjustments to SideBySide
     - Automatically collapse the Perseus JSON view.
     - Moved the PerseusJSON view below the Renderer View
     - Rename to SplitView to better encapsulate the new design
     - Updated variable names to match

[Current (Live) Storybook Example](https://khan.github.io/perseus/?path=/docs/perseus-widgets-numericinput--docs) | [PR Storybook Example](https://650db21c3f5d1b2f13c02952-osexoxinde.chromatic.com/?path=/docs/perseus-widgets-numeric-input--docs)

Issue: LEMS-2449

https://github.com/user-attachments/assets/69f6dbfb-1fda-445b-a06f-90a178f9dbeb

- Ensure all tests pass + manual testing

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (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), ✅ Check builds for changes in size (ubuntu-latest, 20.x)

Pull Request URL: #2138
)

## Summary:
This PR is part of the Numeric Input Project. 

This is a bug fix that ensures that the Examples Tooltip for the Numeric Input widget only displays examples from the _correct_ answers. 

Issue: LEMS-2803

## Test plan:
- Run tests 
- Creation of new snapshot test that verifies wrong answerFormats are not being provided.

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, handeyeco, mark-fitzgerald

Required Reviewers:

Approved By: handeyeco, mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x)

Pull Request URL: #2159
…to Numeric Inputs on Desktop do not cause an infinite loop. (#2182)

## Summary:
Third time's the charm on this one. This ticket is part of the Numeric Input project. 

Numeric Input has different experiences on Desktop versus Mobile: 

1. Desktop allows users to enter basic math commands using their regular keyboard. Desktop does not display / visually support TeX, but CAN parse it as an answer. 
2. Mobile allows users to enter basic math commands using a keypad that crafts TeX to display the output using MathQuill  / Math Input. 

This diverged experience resulted in the possibility to hit an infinite loop on Desktop if the user tries to hand type `\frac` or `\dfrac` TeX commands , as the parser was unable to locate the next symbols to parse. This has likely been a bug since inception, but has become far more noticeable as we're now parsing answers on the fly to provide AI support. As a result, the answers are constantly being evaluated and would hit the infinite loop as soon as the user started typing the expressions.

Issue: LEMS-198

## Test plan:
- Run tests
- New tex wrangler test

Author: SonicScrewdriver

Reviewers: mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ⏹️  [cancelled] Publish npm snapshot (ubuntu-latest, 20.x), ⏹️  [cancelled] Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ⏹️  [cancelled] Cypress (ubuntu-latest, 20.x), ⏹️  [cancelled] Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏹️  [cancelled] Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x)

Pull Request URL: #2182
## Summary:
This PR is part of the Numeric Input Project. 

This PR implements the Wonderblocks ToolTip, while finally deleted the much loathed Perseus Tooltip component. As a result, we have a much more accessible tooltip experience! This solves the issue in LEMS-2815, as the Wonderblocks Tooltip has already solved this issue. 

I have also adjusted the default storybook story to show as many answer forms as possible, to help show the list view for testing. 

Test out the [new experience here.](https://650db21c3f5d1b2f13c02952-naypxoohhw.chromatic.com/?path=/docs/perseus-widgets-numeric-input--docs) 

## Screenshots: 
List View:
![Screenshot 2025-02-05 at 10 00 54 AM](https://github.com/user-attachments/assets/b0093a1b-9f63-46c2-9a3c-e7aa5784496f)

Single Answer Form: 
![Screenshot 2025-02-05 at 10 01 05 AM](https://github.com/user-attachments/assets/3288aa8f-7b15-48f3-a4ce-5bb5cb5300f6)

Single Answer Form with small viewport: 
![Screenshot 2025-02-05 at 10 01 21 AM](https://github.com/user-attachments/assets/4a26669e-bfe5-4cbe-b3aa-63e5951d8f39)

Issue: LEMS-2815

## Test plan:
- tests pass 
- manual testing in Storybook

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (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: #2195
…rs for Numeric Inputs that require Improper fractions. (#2203)

## Summary:
This PR is part of the Numeric Input project. 

This small addition ensures that users cannot be marked correctly for entering whole numbers when required to enter Improper fractions. 

Issue: LEMS-2802

## Test plan:
- Tests pass 
- Creation of two new tests to ensure bug fix works, and there's no regressions for tex

Author: SonicScrewdriver

Reviewers: mark-fitzgerald, SonicScrewdriver

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (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), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x)

Pull Request URL: #2203
)

## Summary:
This PR is part of the Numeric Input project. 

While investigating the scrollbar issue for mobile views, I discovered that we have a lot of hacks in place to make sure that moving the cursor does not move the surrounding numbers/elements. However, this logic was causing a bug that would show a tiny scrollbar when a user first interacts with a Math Input that was set to be right aligned. 

We can fix this without causing any regressions by slightly increasing the padding. 

NOTE: This PR also includes some quick requests regarding changes to aria labels. :) 

Issue: LEMS-2817

## Videos:
Left Aligned:

https://github.com/user-attachments/assets/35e23365-19ef-422b-9d3f-e148b03a76d0

Right Aligned:

https://github.com/user-attachments/assets/7b087a8c-48de-4506-a211-2f7642f7b5e8

## Test plan:
- Manual testing in webapp.

Author: SonicScrewdriver

Reviewers: SonicScrewdriver, mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x)

Pull Request URL: #2187
## Summary:
It was requested that this string be clarified.

Issue: LEMS-2816

## Test plan:
- tests pass

Author: SonicScrewdriver

Reviewers: mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x)

Pull Request URL: #2204
…matically while rebasing feature branch. (#2210)

## Summary:
[sigh-seus] Match main for most recent SSS changes.
[sigh-seus] Remove ts suppression

Issue: LEMS-XXXX

## Test plan:
- tests pass

Author: SonicScrewdriver

Reviewers: mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ⏹️  [cancelled] Publish npm snapshot (ubuntu-latest, 20.x), ⏹️  [cancelled] Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ⏹️  [cancelled] Cypress (ubuntu-latest, 20.x), ⏹️  [cancelled] Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ⏹️  [cancelled] Check builds for changes in size (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x)

Pull Request URL: #2210
…ay under the input. (#2218)

## Summary:
This PR is part of the Numeric Input Project. 

All this does is ensure that the new WB Tooltip for Numeric Input will always display under the actual input. This is to ensure that users will still be able to read the preceding instructions. 

Issue: LEMS-2856

## Test plan:
- tests pass

Author: SonicScrewdriver

Reviewers: mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ⏹️  [cancelled] Publish npm snapshot (ubuntu-latest, 20.x), ⏹️  [cancelled] Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ⏹️  [cancelled] Check builds for changes in size (ubuntu-latest, 20.x), ⏹️  [cancelled] Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ⏹️  [cancelled] Cypress (ubuntu-latest, 20.x)

Pull Request URL: #2218
@SonicScrewdriver SonicScrewdriver force-pushed the feature/numeric-dx-refactor branch from a674b9e to 9135517 Compare February 13, 2025 23:03
@SonicScrewdriver SonicScrewdriver marked this pull request as ready for review February 13, 2025 23:04
…ture branch rebase (#2241)

## Summary:
This micro-pr is part of the Numeric Input Project. 

This PR simply adds one new test for our tooltips, and fixes an issue related to snapshots on the feature branch after some merge conflicts with main. 

# Tests:
- Make sure tests all pass.

Author: SonicScrewdriver

Reviewers: mark-fitzgerald

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ⏹️  [cancelled] Publish npm snapshot (ubuntu-latest, 20.x), ⏹️  [cancelled] Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ⏹️  [cancelled] Cypress (ubuntu-latest, 20.x), ⏹️  [cancelled] Check builds for changes in size (ubuntu-latest, 20.x), ⏹️  [cancelled] Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x)

Pull Request URL: #2241
Copy link
Contributor

@nishasy nishasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything alarming! 🎉


import KEScoreUI from "./ke-score-ui";
import SideBySide from "./side-by-side";
import SideBySide from "./split-view";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely NOT a blocker for landing, but I think this is supposed to be SplitView

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! I can definitely fix that with a quick micro PR :)

Thank you!

Copy link
Contributor

@handeyeco handeyeco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to approve/block because it's a massive PR and I don't have a lot of context. Just some thoughts. Love seeing all the work y'all did; it's much cleaner.

Comment on lines +356 to +358
// [Jan 2025] Third: While testing, I've discovered that we likely don't
// need to be passing setKeypadActive here at all. Removing the parameter
// still results in the same behavior.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove it then?

maxError: number | null | undefined;
// Unsimplified answers are Ungraded, Accepted, or Wrong. Options: "required", "correct", or "enforced"
simplify: string | null | undefined;
simplify: PerseusNumericInputSimplify | null | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. We're sure though that it's okay for this to include "optional"?

Copy link
Contributor Author

@SonicScrewdriver SonicScrewdriver Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional is actually what our editor sets this property to when the Teacher clicks "Accepted" for Unsimplified Answers.

Imo this property could probably use a backfill cleanup at some point as I think there's some old uses of "correct" that came about. I'll grab the data to see how much content actually uses "correct".

Unsimplified answers are:
Ungraded = required
Accepted = optional
Wrong = enforced

Fun fact: This property also used to be a boolean at one point, so we also handle that elsewhere. It's messy.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could probably use a backfill

Would it be worth adding it to the list?

// to check for the existence of a fraction in the input before
// validating the answer. If no fraction is found, we consider
// the answer to be incorrect.
const fractionExists: boolean =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems medium-risk to me (just because changing answer-types often leads to unexpected behavior). I noticed answer-types.test.ts wasn't updated, should we write some tests around this?

maxError: 0.2,
simplify: "optional",
strict: true,
answerForms: ["improper"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, the test is here. I think it might be useful to add some tests to answer-forms.test.ts anyway since it's used by multiple widgets and isn't NumericInput specific.

Comment on lines +24 to +29
inputRef: React.RefObject<KeypadInput>;

constructor(props: any) {
super(props);
this.inputRef = React.createRef<KeypadInput>();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! This is great. One thought, is this possible? I don't remember:

Suggested change
inputRef: React.RefObject<KeypadInput>;
constructor(props: any) {
super(props);
this.inputRef = React.createRef<KeypadInput>();
}
inputRef = React.createRef<KeypadInput>();

If it works, then you don't need the constructor and you can infer the type from createRefs return value.

Comment on lines +47 to +50
version: {
major: 0,
minor: 0,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of this stuff is optional (like version when we're on 0.0). It might make things easier to read if we just included the data that's important to the test.

Comment on lines +75 to +83
answerForms: [
// We don't include proper as otherwise
// the tooltip will hide the examples.
{simplify: "required", name: "integer"},
{simplify: "required", name: "mixed"},
{simplify: "required", name: "improper"},
{simplify: "required", name: "decimal"},
{simplify: "required", name: "pi"},
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these are used, but I would love to know if you think otherwise (please DM me)


import type {PerseusNumericInputAnswerForm} from "@khanacademy/perseus-core";

describe("generateExamples", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

expect(result).toBe(false);
});

it("returns false when no forms are accepted", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When no forms are provided, all forms are accepted so I think this is named wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah makes sense, I'll change "accepted" to "provided"

Comment on lines +11 to +14
strings: PerseusStrings,
) => string;
} = {
integer: (form, strings: PerseusStrings) => strings.integerExample,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are typed on line 11, why do we have to type strings for each function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly certain that I didn't actually change this, it was just copied over from the original implementation. There's likely no reason for how specific this is.

@SonicScrewdriver SonicScrewdriver merged commit b18e88e into main Feb 24, 2025
9 checks passed
@SonicScrewdriver SonicScrewdriver deleted the feature/numeric-dx-refactor branch February 24, 2025 20:19
SonicScrewdriver added a commit that referenced this pull request Mar 3, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @khanacademy/[email protected]

### Major Changes

- [#2261](#2261)
[`5de2e740b`](5de2e74)
Thanks [@handeyeco](https://github.com/handeyeco)! - Make NumericInput
interactive without answer data

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.


- [#2209](#2209)
[`bd8a3b9d5`](bd8a3b9)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Update Input with Examples to use Wonderblocks Tooltip


- [#2209](#2209)
[`d1d5a8247`](d1d5a82)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Modernization and Migration of InputWithExamples to NumericInput folder


- [#2209](#2209)
[`c0149a1b9`](c0149a1)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Refactoring Numeric Input helper functions to remove underscore, improve
documentation, and add tests.


- [#2264](#2264)
[`4eb9fe04a`](4eb9fe0)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Ensure that keyboard users can move points across invalid locations for
all graphs.


- [#2209](#2209)
[`d1b655095`](d1b6550)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Refactoring Numeric Input to move UI-logic to functional component.

### Patch Changes

- [#2263](#2263)
[`4dde99856`](4dde998)
Thanks [@nishasy](https://github.com/nishasy)! - [Interactive Graph]
Update protractor to new SVG


- [#2209](#2209)
[`4a75e6d42`](4a75e6d)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Fixing changes that did not migrate automatically while rebasing feature
branch.


- [#2209](#2209)
[`e797a6a25`](e797a6a)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Update aria label for whe ncontent creators do not provide one


- [#2252](#2252)
[`e7ad604af`](e7ad604)
Thanks [@nishasy](https://github.com/nishasy)! - [SR] Update Linear
System strings


- [#2209](#2209)
[`913551712`](9135517)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Ensure Numeric Input Tooltips display under the input.


- [#2251](#2251)
[`e5d17bbf2`](e5d17bb)
Thanks [@nishasy](https://github.com/nishasy)! - [SR] Update Linear
strings


- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)


- [#2268](#2268)
[`9d01457fc`](9d01457)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Minor
dev improvements for Numeric Input after Refactor changes.


- [#2254](#2254)
[`56b4ee61b`](56b4ee6)
Thanks [@benchristel](https://github.com/benchristel)! - Internal: test
that Interactive Graph widgets can render with answerless data


- [#2253](#2253)
[`24e2b4e45`](24e2b4e)
Thanks [@nishasy](https://github.com/nishasy)! - [SR] Update sinusoid
strings


- [#2209](#2209)
[`926d42c99`](926d42c)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Bug
fix to ensure that Numeric Examples only show for correct answers.


- [#2231](#2231)
[`08409c6c9`](08409c6)
Thanks [@handeyeco](https://github.com/handeyeco)! - Add tests for
answerless Dropdown support


- [#2209](#2209)
[`b9f5f97a8`](b9f5f97)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Cleanup of Numeric Input stories


- [#2250](#2250)
[`f6795c2e4`](f6795c2)
Thanks [@nishasy](https://github.com/nishasy)! - [SR] Update Circle
strings


- [#2241](#2241)
[`a0c897d74`](a0c897d)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Update tests and fix snapshots from feature branch rebase

- Updated dependencies
\[[`90034a875`](90034a8),
[`dcf9017d9`](dcf9017),
[`e7ad604af`](e7ad604),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`a90cf7901`](a90cf79),
[`e797a6a25`](e797a6a),
[`9d01457fc`](9d01457),
[`56b4ee61b`](56b4ee6),
[`da01542f2`](da01542),
[`5de2e740b`](5de2e74),
[`458d3ed60`](458d3ed),
[`ee91b7063`](ee91b70),
[`20a08315b`](20a0831),
[`d1d5a8247`](d1d5a82),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6),
[`d1b655095`](d1b6550)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Major Changes

- [#2261](#2261)
[`5de2e740b`](5de2e74)
Thanks [@handeyeco](https://github.com/handeyeco)! - Make NumericInput
interactive without answer data

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.


- [#2209](#2209)
[`c0149a1b9`](c0149a1)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Refactoring Numeric Input helper functions to remove underscore, improve
documentation, and add tests.

### Patch Changes

- [#2269](#2269)
[`90034a875`](90034a8)
Thanks [@benchristel](https://github.com/benchristel)! - Bugfix: Allow
null values when parsing the domain of a locked function on an
Interactive Graph widget, converting them to +/-Infinity. Note that
Infinity is serialized to JSON as `null`, so this preserves the existing
persisted data format.


- [#2255](#2255)
[`b71154170`](b711541)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Bug
fix for Marathi language support in getDecimalSeparator


- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)


- [#2254](#2254)
[`56b4ee61b`](56b4ee6)
Thanks [@benchristel](https://github.com/benchristel)! - Internal: test
that Interactive Graph widgets can render with answerless data


- [#2267](#2267)
[`381842745`](3818427)
Thanks [@benchristel](https://github.com/benchristel)! - Bugfix: Convert
null to undefined in the `replace` field of hints.

This fixes a parser error observed in production. `replace` is null in
some assessment
    items.


- [#2231](#2231)
[`08409c6c9`](08409c6)
Thanks [@handeyeco](https://github.com/handeyeco)! - Add tests for
answerless Dropdown support

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

### Patch Changes

- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)


- [#2266](#2266)
[`20a08315b`](20a0831)
Thanks [@handeyeco](https://github.com/handeyeco)! - Bugfix: KAS
handling functions around plain numbers

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

### Patch Changes

- Updated dependencies
\[[`90034a875`](90034a8),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`a90cf7901`](a90cf79),
[`56b4ee61b`](56b4ee6),
[`5de2e740b`](5de2e74),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

### Patch Changes

- [#2252](#2252)
[`e7ad604af`](e7ad604)
Thanks [@nishasy](https://github.com/nishasy)! - [SR] Update Linear
System strings


- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)

- Updated dependencies
\[[`90034a875`](90034a8),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`a90cf7901`](a90cf79),
[`56b4ee61b`](56b4ee6),
[`5de2e740b`](5de2e74),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.


- [#2209](#2209)
[`d1d5a8247`](d1d5a82)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Modernization and Migration of InputWithExamples to NumericInput folder


- [#2209](#2209)
[`c0149a1b9`](c0149a1)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Refactoring Numeric Input helper functions to remove underscore, improve
documentation, and add tests.


- [#2209](#2209)
[`d1b655095`](d1b6550)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Refactoring Numeric Input to move UI-logic to functional component.

### Patch Changes

- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)


- [#2209](#2209)
[`e797a6a25`](e797a6a)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Fixing bug where scrollbars would appear in Math Input when right
aligned.

- Updated dependencies
\[[`90034a875`](90034a8),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`a90cf7901`](a90cf79),
[`56b4ee61b`](56b4ee6),
[`5de2e740b`](5de2e74),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.


- [#2265](#2265)
[`e53c2ac71`](e53c2ac)
Thanks [@Myranae](https://github.com/Myranae)! - Export the
ContentPreview component from perseus-editor

### Patch Changes

- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)


- [#2209](#2209)
[`612d3b53f`](612d3b5)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Minor
string update for Numeric editor


- [#2256](#2256)
[`68bd12587`](68bd125)
Thanks [@nishasy](https://github.com/nishasy)! - [SR Tree] Add infotip
with explanation about SR Tree

- Updated dependencies
\[[`90034a875`](90034a8),
[`4dde99856`](4dde998),
[`4a75e6d42`](4a75e6d),
[`dcf9017d9`](dcf9017),
[`e797a6a25`](e797a6a),
[`e7ad604af`](e7ad604),
[`913551712`](9135517),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`e5d17bbf2`](e5d17bb),
[`a90cf7901`](a90cf79),
[`e797a6a25`](e797a6a),
[`9d01457fc`](9d01457),
[`56b4ee61b`](56b4ee6),
[`da01542f2`](da01542),
[`5de2e740b`](5de2e74),
[`24e2b4e45`](24e2b4e),
[`458d3ed60`](458d3ed),
[`ee91b7063`](ee91b70),
[`bd8a3b9d5`](bd8a3b9),
[`20a08315b`](20a0831),
[`d1d5a8247`](d1d5a82),
[`926d42c99`](926d42c),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6),
[`b9f5f97a8`](b9f5f97),
[`4eb9fe04a`](4eb9fe0),
[`d1b655095`](d1b6550),
[`f6795c2e4`](f6795c2),
[`a0c897d74`](a0c897d)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.


- [#2262](#2262)
[`da01542f2`](da01542)
Thanks [@Myranae](https://github.com/Myranae)! - Add linter rule to
catch images added to content without a URL

### Patch Changes

- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)

- Updated dependencies
\[[`90034a875`](90034a8),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`a90cf7901`](a90cf79),
[`56b4ee61b`](56b4ee6),
[`5de2e740b`](5de2e74),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2209](#2209)
[`dcf9017d9`](dcf9017)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Bugfix to ensure that Numerics that require Improper fractions don't
accept whole numbers.


- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

### Patch Changes

- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)


- [#2268](#2268)
[`9d01457fc`](9d01457)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Minor
dev improvements for Numeric Input after Refactor changes.


- [#2271](#2271)
[`458d3ed60`](458d3ed)
Thanks [@handeyeco](https://github.com/handeyeco)! - Add test for TeX in
Expression scoring


- [#2209](#2209)
[`ee91b7063`](ee91b70)
Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! -
Bugfix to ensure users cannot create infinite loop with incomplete tex
in Numeric Input


- [#2266](#2266)
[`20a08315b`](20a0831)
Thanks [@handeyeco](https://github.com/handeyeco)! - Bugfix: KAS
handling functions around plain numbers

- Updated dependencies
\[[`90034a875`](90034a8),
[`e7ad604af`](e7ad604),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`a90cf7901`](a90cf79),
[`56b4ee61b`](56b4ee6),
[`5de2e740b`](5de2e74),
[`20a08315b`](20a0831),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

### Patch Changes

- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)

- Updated dependencies
\[[`c7f6f63c8`](c7f6f63),
[`a90cf7901`](a90cf79)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

### Patch Changes

- [#2259](#2259)
[`a90cf7901`](a90cf79)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Minor change to
how each package embeds it's package version in itself (slightly larger
bundle size)

## [email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

## @khanacademy/[email protected]

### Minor Changes

- [#2202](#2202)
[`c7f6f63c8`](c7f6f63)
Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Tooling:

    -   Switching to `pnpm`.

### Patch Changes

- Updated dependencies
\[[`90034a875`](90034a8),
[`e7ad604af`](e7ad604),
[`c7f6f63c8`](c7f6f63),
[`b71154170`](b711541),
[`a90cf7901`](a90cf79),
[`e797a6a25`](e797a6a),
[`56b4ee61b`](56b4ee6),
[`da01542f2`](da01542),
[`5de2e740b`](5de2e74),
[`20a08315b`](20a0831),
[`d1d5a8247`](d1d5a82),
[`381842745`](3818427),
[`c0149a1b9`](c0149a1),
[`08409c6c9`](08409c6),
[`d1b655095`](d1b6550)]:
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
    -   @khanacademy/[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants