Skip to content

Commit af6d890

Browse files
authored
Dropdown story with answerless data (#2305)
## Summary: Create a Storybook story for the Dropdown widget that renders with answerless data, is interactive, and is scorable. Issue: LEMS-2930 ## Test plan: - Confirm all checks pass - Confirm story renders, is interactive, and can be scored Author: Myranae Reviewers: jeremywiebe, benchristel, Myranae, handeyeco Required Reviewers: Approved By: jeremywiebe, benchristel Checks: ✅ 8 checks were successful Pull Request URL: #2305
1 parent 5e7a608 commit af6d890

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

.changeset/quiet-insects-agree.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@khanacademy/perseus": minor
3+
---
4+
5+
Add a story for Dropdown that uses answerless data

packages/perseus-core/src/utils/split-perseus-item.ts

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import {getUpgradedWidgetOptions} from "../widgets/upgrade";
55

66
import type {PerseusRenderer} from "../data-schema";
77

8+
/**
9+
* Upgrades widget options and removes answerful data for all the widgets in a
10+
* Perseus item.
11+
*/
812
export default function splitPerseusItem(
913
originalItem: PerseusRenderer,
1014
): PerseusRenderer {

packages/perseus/src/widgets/dropdown/dropdown.stories.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {splitPerseusItem} from "@khanacademy/perseus-core";
12
import * as React from "react";
23

34
import {RendererWithDebugUI} from "../../../../../testing/renderer-with-debug-ui";
@@ -41,3 +42,7 @@ export const DropdownWithEmptyPlaceholder = (
4142
): React.ReactElement => {
4243
return <RendererWithDebugUI question={dropdownWithEmptyPlaceholder} />;
4344
};
45+
46+
export const DropdownWithNoAnswers = (args: StoryArgs): React.ReactElement => {
47+
return <RendererWithDebugUI question={splitPerseusItem(basicDropdown)} />;
48+
};

0 commit comments

Comments
 (0)