-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Interactive Graph: test utils] Do not set the coords field by defaul…
…t in the builder (#1505) ## Summary: The builder should not be setting the `coords` inside the graph's `correct` field by default. The correct answer `coords` get set after the content authors interact with the graph's "correct answer" preview. When the coords are undefined, the graph renders with the default starting coords. If we were to pass in the coords explicitly in the builder, it would (a) not be an accurate representation of the initial state of a graph, and (b) we would have to make sure we use the initialization logic to confirm that we're setting coords based on the number of segments, sides, or points for segment graphs, polygon graphs, and point graphs respectively. Updating the coords to be undefined by default inside the builder also fixes an issue where the "correct answer" preview was showing the wrong graph values because the values were set to the wrong default values in the builder. Issue: none ## Test plan: `yarn jest packages/perseus/src/widgets/interactive-graphs/interactive-graph-question-builder.test.ts` Storybook - Segments - http://localhost:6006/?path=/story/perseuseditor-widgets-interactive-graph--interactive-graph-segments - Polygons - http://localhost:6006/?path=/story/perseuseditor-widgets-interactive-graph--interactive-graph-polygon ## Screenshots | Before | After | | --- | --- | | <img width="923" alt="Screenshot 2024-08-08 at 4 26 16 PM" src="https://github.com/user-attachments/assets/eace2258-44b5-4d2f-a785-adbaecdd5985"> | <img width="929" alt="Screenshot 2024-08-08 at 4 26 22 PM" src="https://github.com/user-attachments/assets/6b6abe81-e19d-4342-bfcf-f84b189531c1"> | | <img width="925" alt="Screenshot 2024-08-08 at 4 26 47 PM" src="https://github.com/user-attachments/assets/5004b44f-ad74-4dac-ba55-5d24a33dc8a3"> | <img width="922" alt="Screenshot 2024-08-08 at 4 26 53 PM" src="https://github.com/user-attachments/assets/13cbf50c-2fd6-47a4-bf7f-851c6ace18c3"> | Author: nishasy Reviewers: benchristel Required Reviewers: Approved By: benchristel Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ gerald, ⏭️ Publish npm snapshot, ✅ Jest Coverage (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), 🚫 Upload Coverage, ✅ gerald, ⏭️ Publish npm snapshot, 🚫 Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), 🚫 Cypress (ubuntu-latest, 20.x), 🚫 Jest Coverage (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), ✅ gerald Pull Request URL: #1505
- Loading branch information
Showing
3 changed files
with
22 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
--- | ||
|
||
[Interactive Graph: test utils] Do not set the coords field by default in the builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters