Skip to content

Commit

Permalink
Add feature flag for polygon with unlimited polygon. (#1732)
Browse files Browse the repository at this point in the history
## Summary:
Adding feature flag for the polygon unlimited sides work.

Issue: LEMS-1839

## Test plan:
Ideally no code should be effected by this new feature flag. This is here so future POC and rollout of experience is behind the proper flag.

Author: catandthemachines

Reviewers: benchristel, anakaren-rojas, nicolecomputer

Required Reviewers:

Approved By: benchristel

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), ✅ gerald

Pull Request URL: #1732
  • Loading branch information
catandthemachines authored Oct 9, 2024
1 parent 93baf22 commit c57e114
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/ninety-hairs-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Adding Unlimited Polygon feature flag.
2 changes: 2 additions & 0 deletions packages/perseus/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ export const MafsGraphTypeFlags = [
"ray",
/** Enables the `polygon` interactive-graph type a fixed number of sides. */
"polygon",
/** Enable the `unlimited-polygon` interactive graph type for an unlimited number of sides */
"unlimited-polygon",
/** Enables the `circle` interactive-graph type. */
"circle",
/** Enables the `quadratic` interactive-graph type. */
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/src/widgets/interactive-graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,7 @@ export function shouldUseMafs(
// TODO(benchristel): add a feature flag for the "unlimited"
// case once we've implemented polygon graphs with unlimited
// sides
return false;
return Boolean(mafsFlags["unlimited-polygon"]);
}
return Boolean(mafsFlags["polygon"]);
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ describe("a mafs graph", () => {
quadratic: quadraticQuestion,
sinusoid: sinusoidQuestion,
"unlimited-point": pointQuestion,
"unlimited-polygon": polygonQuestion,
};

const graphQuestionRenderersCorrect: {
Expand All @@ -231,6 +232,7 @@ describe("a mafs graph", () => {
quadratic: quadraticQuestionWithDefaultCorrect,
sinusoid: sinusoidQuestionWithDefaultCorrect,
"unlimited-point": pointQuestionWithDefaultCorrect,
"unlimited-polygon": polygonQuestionDefaultCorrect,
};

describe.each(Object.entries(graphQuestionRenderers))(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const mafsSupportedGraphTypes = [
"quadratic",
"sinusoid",
"unlimited-point",
"unlimited-polygon",
] as const;

export type MafsSupportedGraphType = (typeof mafsSupportedGraphTypes)[number];
Expand Down

0 comments on commit c57e114

Please sign in to comment.