Commit 115a086
authored
## Summary
- `packages/perseus-core/src/data-schema.ts` — adds CalculatorVariant type ("scientific" | "graphing" | "four_function") and extends PerseusAnswerArea with calculatorVariant: CalculatorVariant | null
- `packages/perseus-core/src/parse-perseus-json/perseus-parsers/perseus-answer-area.ts` — adds calculatorVariant field to parser using nullable(enumeration(...)) for strict validation; migrates legacy calculator: true content to calculatorVariant: "scientific" on parse
- `packages/perseus-core/src/utils/get-default-answer-area.ts` — includes `calculatorVariant: null` in the default answer area
- `packages/perseus-editor/src/item-extras-editor.tsx` — converts flat "Show calculator" checkbox into an expandable group matching the financial calculator pattern; selecting the parent defaults to scientific; sub-options behave as mutually exclusive radio buttons
- Remaining files add `calculatorVariant:null` to tests
### Notes
- The legacy calculator boolean is preserved and kept in sync for backward compatibility while the frontend migrates
- Existing content without calculatorVariant defaults to null (or "scientific" if calculator: true)
[Associated Webapp Change](Khan/webapp#40228)
Issue: LEMS-4171
## Test plan:
Validated with [ZND](https://prod-znd-260616-12526-c35f366.khanacademy.org/math/ap-statistics/bivariate-data-ap/least-squares-regression/e/calculating-equation-least-squares)
### Scenarios tested
- [x] Unchecked `Show Calculator` doesn't show Calculator button
- [x] Checked defaults to `Scientific`
- [x] Changing from default to Graphing shows graphing
- [x] Changing to four function shows four function
https://github.com/user-attachments/assets/55c08478-508b-4c62-8232-50160b5f821c
Author: anakaren-rojas
Reviewers: jeremywiebe, anakaren-rojas
Required Reviewers:
Approved By: jeremywiebe
Checks: ⏭️ 1 check has been skipped, ✅ 11 checks were successful
Pull Request URL: #3780
1 parent 0bd0842 commit 115a086
25 files changed
Lines changed: 353 additions & 11 deletions
File tree
- .changeset
- packages
- perseus-core/src
- parse-perseus-json
- perseus-parsers
- regression-tests/__snapshots__
- utils
- generators
- perseus-editor/src
- __tests__
- diffs/__tests__
- __snapshots__
- testing
- perseus/src
- __tests__
- testing
- item-flipbook
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
364 | 369 | | |
365 | 370 | | |
366 | 371 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
2 | 12 | | |
3 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
4 | 18 | | |
5 | | - | |
| 19 | + | |
6 | 20 | | |
7 | 21 | | |
| 22 | + | |
8 | 23 | | |
9 | 24 | | |
10 | 25 | | |
| |||
13 | 28 | | |
14 | 29 | | |
15 | 30 | | |
| 31 | + | |
16 | 32 | | |
17 | 33 | | |
18 | 34 | | |
19 | 35 | | |
20 | 36 | | |
21 | 37 | | |
22 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments