-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Locked Labels] Count lone unescaped $ as regular dollar signs #1875
base: labels-util-function
Are you sure you want to change the base?
Conversation
Right now, if you type "$1" into the locked label input, it shows up as "undefined1" in the graph TeX. - Update the parsed content to count a lone unescaped $ as a regular $. Issue: https://khanacademy.atlassian.net/browse/LEMS-2591 Test plan: `yarn jest packages/perseus/src/widgets/interactive-graphs/utils.test.ts` Storybook - Go to http://localhost:6006/?path=/story/perseuseditor-widgets-interactive-graph--interactive-graph-with-aria-label - Create a new locked figure - Add a label "$1" and confirm it shows up as "$1" in the preview - Play around with different escaped and unescaped dollar signs and confirm they work as expected
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (7827abc) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1875 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1875 |
Size Change: -264 B (-0.02%) Total Size: 1.29 MB
ℹ️ View Unchanged
|
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
${"$1"} | ${"\\text{\\$1}"} | ||
${"1$"} | ${"\\text{1\\$}"} | ||
${"$$1$"} | ${"\\text{1\\$}"} | ||
${"$1$$"} | ${"1\\text{\\$}"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice set of test cases :)
expect(screen.getByText("1/2")).toBeInTheDocument(); | ||
expect(screen.getByText("3/4")).toBeInTheDocument(); | ||
expect(screen.getByText("\\text{$1/2$}")).toBeInTheDocument(); | ||
expect(screen.getByText("\\text{$3/4$}")).toBeInTheDocument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anakaren-rojas I think my update affected some of your recent changes. Does this look okay to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: Yes, looks good
For these, I think it would be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$\frac{1}{2}$
renders correctly when I test it out in storybook, so the functionality updates you made look right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double checked the axis labels and they render correctly when I tried a few different variations of TeX 🎉
expect(screen.getByText("1/2")).toBeInTheDocument(); | ||
expect(screen.getByText("3/4")).toBeInTheDocument(); | ||
expect(screen.getByText("\\text{$1/2$}")).toBeInTheDocument(); | ||
expect(screen.getByText("\\text{$3/4$}")).toBeInTheDocument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: Yes, looks good
For these, I think it would be
expect(screen.getByText("1/2")).toBeInTheDocument(); | ||
expect(screen.getByText("3/4")).toBeInTheDocument(); | ||
expect(screen.getByText("\\text{$1/2$}")).toBeInTheDocument(); | ||
expect(screen.getByText("\\text{$3/4$}")).toBeInTheDocument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$\frac{1}{2}$
renders correctly when I test it out in storybook, so the functionality updates you made look right
Summary:
Right now, if you type "$1" into the locked label input, it
shows up as "undefined1" in the graph TeX.
as a regular $.
Issue: https://khanacademy.atlassian.net/browse/LEMS-2591
Test plan:
yarn jest packages/perseus/src/widgets/interactive-graphs/utils.test.ts
Storybook
and confirm they work as expected
Demo
Screen.Recording.2024-11-15.at.5.46.21.PM.mov