Skip to content

Commit

Permalink
Merge branch 'feature/client-validation' into tb/LEMS-2440/iframe-sep…
Browse files Browse the repository at this point in the history
…arate-answers-from-user-input
  • Loading branch information
Myranae committed Dec 17, 2024
2 parents f95eca0 + 193d913 commit d1e5b22
Show file tree
Hide file tree
Showing 43 changed files with 847 additions and 225 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-adults-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": minor
---

Change empty widgets check in Renderer to depend only on data available (and not on scoring data)
5 changes: 5 additions & 0 deletions .changeset/spicy-cups-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

TESTS: swap input-number out of renderer tests as it is deprecated
7 changes: 7 additions & 0 deletions packages/perseus-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @khanacademy/perseus-editor

## 16.0.4

### Patch Changes

- Updated dependencies [[`09d906cd2`](https://github.com/Khan/perseus/commit/09d906cd289a886bdc92b8a5df65ccbc8ad3f29e), [`99e55b623`](https://github.com/Khan/perseus/commit/99e55b623deef244f99b554d8aa7ef0fb45a4bbb), [`ac07da03c`](https://github.com/Khan/perseus/commit/ac07da03cb332f9dd9ebf82820e409b9fb0844be), [`2135e0dc3`](https://github.com/Khan/perseus/commit/2135e0dc3eddde1b3c842223e10e1ee94823c7e7)]:
- @khanacademy/perseus@48.2.0

## 16.0.3

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/perseus-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Perseus editors",
"author": "Khan Academy",
"license": "MIT",
"version": "16.0.3",
"version": "16.0.4",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -38,7 +38,7 @@
"@khanacademy/keypad-context": "^1.0.5",
"@khanacademy/kmath": "^0.1.17",
"@khanacademy/math-input": "^21.1.7",
"@khanacademy/perseus": "^48.1.0",
"@khanacademy/perseus": "^48.2.0",
"@khanacademy/perseus-core": "2.0.0",
"@khanacademy/pure-markdown": "^0.3.14",
"mafs": "^0.19.0"
Expand Down
14 changes: 14 additions & 0 deletions packages/perseus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @khanacademy/perseus

## 48.2.0

### Minor Changes

- [#2001](https://github.com/Khan/perseus/pull/2001) [`ac07da03c`](https://github.com/Khan/perseus/commit/ac07da03cb332f9dd9ebf82820e409b9fb0844be) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Undoing changes to svg-image

* [#2004](https://github.com/Khan/perseus/pull/2004) [`2135e0dc3`](https://github.com/Khan/perseus/commit/2135e0dc3eddde1b3c842223e10e1ee94823c7e7) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Fix for svg-image loading issues.

### Patch Changes

- [#1928](https://github.com/Khan/perseus/pull/1928) [`09d906cd2`](https://github.com/Khan/perseus/commit/09d906cd289a886bdc92b8a5df65ccbc8ad3f29e) Thanks [@nishasy](https://github.com/nishasy)! - [SR] Add screenreader support for circle graph

* [#1993](https://github.com/Khan/perseus/pull/1993) [`99e55b623`](https://github.com/Khan/perseus/commit/99e55b623deef244f99b554d8aa7ef0fb45a4bbb) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Internal: introduce `ValidationResult` for use in validation functions

## 48.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/perseus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Core Perseus API (includes renderers and widgets)",
"author": "Khan Academy",
"license": "MIT",
"version": "48.1.0",
"version": "48.2.0",
"publishConfig": {
"access": "public"
},
Expand Down
57 changes: 45 additions & 12 deletions packages/perseus/src/__testdata__/renderer.testdata.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import type {
DropdownWidget,
ExpressionWidget,
ImageWidget,
InputNumberWidget,
NumericInputWidget,
PerseusRenderer,
} from "../perseus-types";
import type {RenderProps} from "../widgets/radio";

export const expressionWidget: ExpressionWidget = {
type: "expression",
options: {
answerForms: [
{
considered: "correct",
form: true,
simplify: true,
value: "1.0",
},
],
buttonSets: ["basic"],
functions: [],
times: true,
},
};

export const dropdownWidget: DropdownWidget = {
type: "dropdown",
alignment: "default",
Expand Down Expand Up @@ -49,22 +67,31 @@ export const imageWidget: ImageWidget = {
version: {major: 0, minor: 0},
};

export const inputNumberWidget: InputNumberWidget = {
export const numericInputWidget: NumericInputWidget = {
graded: true,
version: {
major: 0,
minor: 0,
},
type: "input-number",
graded: true,
alignment: "default",
static: false,
type: "numeric-input",
options: {
maxError: 0.1,
inexact: false,
value: 0.3333333333333333,
simplify: "optional",
answerType: "rational",
coefficient: false,
static: false,
answers: [
{
status: "correct",
maxError: null,
strict: false,
value: 1252,
simplify: "required",
message: "",
},
],
labelText: "",
size: "normal",
},
alignment: "default",
};

export const question1: PerseusRenderer = {
Expand All @@ -76,15 +103,21 @@ export const question1: PerseusRenderer = {

export const question2: PerseusRenderer = {
content:
"Denis baked a peach pie and cut it into $3$ equal-sized pieces. Denis's dad eats $1$ section of the pie. \n\n**What fraction of the pie did Denis's dad eat?** \n![](https://ka-perseus-graphie.s3.amazonaws.com/74a2b7583a2c26ebfb3ad714e29867541253fc97.png) \n[[\u2603 input-number 1]] \n\n\n\n",
"Denis baked a peach pie and cut it into $3$ equal-sized pieces. Denis's dad eats $1$ section of the pie. \n\n**What fraction of the pie did Denis's dad eat?** \n![](https://ka-perseus-graphie.s3.amazonaws.com/74a2b7583a2c26ebfb3ad714e29867541253fc97.png) \n[[\u2603 numeric-input 1]] \n\n\n\n",
images: {
"https://ka-perseus-graphie.s3.amazonaws.com/74a2b7583a2c26ebfb3ad714e29867541253fc97.png":
{
width: 200,
height: 200,
},
},
widgets: {"input-number 1": inputNumberWidget},
widgets: {"numeric-input 1": numericInputWidget},
};

export const question3: PerseusRenderer = {
content: "Enter $1.0$ in the input field: [[\u2603 expression 1]]\n\n\n\n",
images: {},
widgets: {"expression 1": expressionWidget},
};

export const definitionItem: PerseusRenderer = {
Expand Down
12 changes: 6 additions & 6 deletions packages/perseus/src/__tests__/perseus-markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe("perseus markdown", () => {
],
},
{
content: "[[☃ test 1]]+[[☃ input-number 2]]",
content: "[[☃ test 1]]+[[☃ numeric-input 2]]",
expected: [
{
type: "paragraph",
Expand All @@ -314,15 +314,15 @@ describe("perseus markdown", () => {
},
{
type: "widget",
widgetType: "input-number",
id: "input-number 2",
widgetType: "numeric-input",
id: "numeric-input 2",
},
],
},
],
},
{
content: "*[[☃ test 2]]* [[☃ input-number 1]]",
content: "*[[☃ test 2]]* [[☃ numeric-input 1]]",
expected: [
{
type: "paragraph",
Expand All @@ -343,8 +343,8 @@ describe("perseus markdown", () => {
},
{
type: "widget",
widgetType: "input-number",
id: "input-number 1",
widgetType: "numeric-input",
id: "numeric-input 1",
},
],
},
Expand Down
Loading

0 comments on commit d1e5b22

Please sign in to comment.