-
Notifications
You must be signed in to change notification settings - Fork 350
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
[Hint Mode: Start Coords] Add start coords UI for polygon graphs (snap to grid only) #1488
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@khanacademy/perseus": minor | ||
"@khanacademy/perseus-editor": minor | ||
--- | ||
|
||
[Hint Mode: Start Coords] Add start coords UI for polygon graphs (snap to grid only) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -700,9 +700,10 @@ describe("InteractiveGraphEditor", () => { | |
...flags, | ||
mafs: { | ||
...flags.mafs, | ||
"start-coords-ui-phase-1": shouldRender, | ||
"start-coords-ui-phase-1": true, | ||
"start-coords-ui-phase-2": false, | ||
"start-coords-ui-point": false, | ||
"start-coords-ui-polygon": false, | ||
}, | ||
}, | ||
}} | ||
|
@@ -738,7 +739,7 @@ describe("InteractiveGraphEditor", () => { | |
${"linear-system"} | ${false} | ||
${"segment"} | ${false} | ||
${"circle"} | ${false} | ||
${"quadratic"} | ${false} | ||
${"quadratic"} | ${true} | ||
${"sinusoid"} | ${true} | ||
${"polygon"} | ${false} | ||
${"angle"} | ${false} | ||
|
@@ -759,8 +760,9 @@ describe("InteractiveGraphEditor", () => { | |
mafs: { | ||
...flags.mafs, | ||
"start-coords-ui-phase-1": false, | ||
"start-coords-ui-phase-2": shouldRender, | ||
"start-coords-ui-phase-2": true, | ||
"start-coords-ui-point": false, | ||
"start-coords-ui-polygon": false, | ||
}, | ||
}, | ||
}} | ||
|
@@ -818,7 +820,67 @@ describe("InteractiveGraphEditor", () => { | |
...flags.mafs, | ||
"start-coords-ui-phase-1": false, | ||
"start-coords-ui-phase-2": false, | ||
"start-coords-ui-point": shouldRender, | ||
"start-coords-ui-point": true, | ||
"start-coords-ui-polygon": false, | ||
}, | ||
}, | ||
}} | ||
graph={{type}} | ||
correct={{type}} | ||
/>, | ||
{ | ||
wrapper: RenderStateRoot, | ||
}, | ||
); | ||
|
||
// Assert | ||
if (shouldRender) { | ||
expect( | ||
await screen.findByRole("button", { | ||
name: "Use default start coordinates", | ||
}), | ||
).toBeInTheDocument(); | ||
} else { | ||
expect( | ||
screen.queryByRole("button", { | ||
name: "Use default start coordinates", | ||
}), | ||
).toBeNull(); | ||
} | ||
}, | ||
); | ||
|
||
test.each` | ||
type | shouldRender | ||
${"linear"} | ${false} | ||
${"ray"} | ${false} | ||
${"linear-system"} | ${false} | ||
${"segment"} | ${false} | ||
${"circle"} | ${false} | ||
${"quadratic"} | ${false} | ||
${"sinusoid"} | ${false} | ||
${"polygon"} | ${true} | ||
${"angle"} | ${false} | ||
${"point"} | ${false} | ||
`( | ||
"should render for $type graphs if polygon flag is on: $shouldRender", | ||
async ({type, shouldRender}) => { | ||
// Arrange | ||
|
||
// Act | ||
Comment on lines
+868
to
+870
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: Is it best practice to still have both of these (arrange and act) and to have them separate like this if arrange is empty? Just curious as I usually combine them and want to make sure I do it the best way 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like there's no style guide for this, but there's a preference among folks to leave the comments on separate lines. https://khanacademy.slack.com/archives/CJSB0D3BN/p1722962522758789 |
||
render( | ||
<InteractiveGraphEditor | ||
{...baseProps} | ||
apiOptions={{ | ||
...ApiOptions.defaults, | ||
flags: { | ||
...flags, | ||
mafs: { | ||
...flags.mafs, | ||
"start-coords-ui-phase-1": false, | ||
"start-coords-ui-phase-2": false, | ||
"start-coords-ui-point": false, | ||
"start-coords-ui-polygon": true, | ||
}, | ||
}, | ||
}} | ||
|
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.
I'm so embarrassed by how broken these tests were. They basically weren't even testing anything! 😬