Skip to content

Commit

Permalink
Update snapshots after merging in main.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fitzgerald committed Dec 3, 2024
2 parents 3bf13ec + e3062b3 commit 07ac191
Show file tree
Hide file tree
Showing 31 changed files with 1,833 additions and 1,398 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-turtles-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": minor
---

[Numeric Input] - Update the UI to match Expression widget
6 changes: 6 additions & 0 deletions dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @khanacademy/perseus-dev-ui

## 4.0.3

### Patch Changes

- [#1910](https://github.com/Khan/perseus/pull/1910) [`0a44d468d`](https://github.com/Khan/perseus/commit/0a44d468dd127bf15dc32e720b9b0301af41a572) Thanks [@handeyeco](https://github.com/handeyeco)! - Change ServerItemRenderer scoring APIs to externalize scoring

## 4.0.2

### Patch Changes
Expand Down
11 changes: 10 additions & 1 deletion dev/flipbook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {useEffect, useMemo, useReducer, useRef, useState} from "react";

import {Renderer} from "../packages/perseus/src";
import {SvgImage} from "../packages/perseus/src/components";
import {scorePerseusItem} from "../packages/perseus/src/renderer-util";
import {mockStrings} from "../packages/perseus/src/strings";
import {isCorrect} from "../packages/perseus/src/util";
import {trueForAllMafsSupportedGraphTypes} from "../packages/perseus/src/widgets/interactive-graphs/mafs-supported-graph-types";
Expand Down Expand Up @@ -319,7 +320,15 @@ function GradableRenderer(props: QuestionRendererProps) {
leftContent={
<Button
onClick={() => {
setScore(rendererRef.current?.score());
if (rendererRef.current) {
const score = scorePerseusItem(
question,
rendererRef.current.getUserInputMap(),
mockStrings,
"en",
);
setScore(score);
}
clearScoreTimeout.set();
}}
>
Expand Down
2 changes: 1 addition & 1 deletion dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Perseus dev UI",
"author": "Khan Academy",
"license": "MIT",
"version": "4.0.2",
"version": "4.0.3",
"private": true,
"repository": {
"type": "git",
Expand Down
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

## 15.1.1

### Patch Changes

- Updated dependencies [[`0a44d468d`](https://github.com/Khan/perseus/commit/0a44d468dd127bf15dc32e720b9b0301af41a572)]:
- @khanacademy/perseus@45.0.0

## 15.1.0

### Minor 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": "15.1.0",
"version": "15.1.1",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -38,7 +38,7 @@
"@khanacademy/keypad-context": "^1.0.4",
"@khanacademy/kmath": "^0.1.16",
"@khanacademy/math-input": "^21.1.6",
"@khanacademy/perseus": "^44.0.0",
"@khanacademy/perseus": "^45.0.0",
"@khanacademy/perseus-core": "1.5.3",
"@khanacademy/pure-markdown": "^0.3.13",
"mafs": "^0.19.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/perseus/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @khanacademy/perseus

## 45.0.0

### Major Changes

- [#1910](https://github.com/Khan/perseus/pull/1910) [`0a44d468d`](https://github.com/Khan/perseus/commit/0a44d468dd127bf15dc32e720b9b0301af41a572) Thanks [@handeyeco](https://github.com/handeyeco)! - Change ServerItemRenderer scoring APIs to externalize scoring

## 44.0.0

### Major 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": "44.0.0",
"version": "45.0.0",
"publishConfig": {
"access": "public"
},
Expand Down
12 changes: 4 additions & 8 deletions packages/perseus/src/components/__tests__/sorter.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,13 @@ describe("sorter widget", () => {
const {renderer} = renderQuestion(question1, apiOptions);
const sorter = renderer.findWidgets("sorter 1")[0];

// Act
// Put the options in the correct order

["$0.005$ kilograms", "$15$ grams", "$55$ grams"].forEach((option) => {
act(() => sorter.moveOptionToIndex(option, 3));
});
// Act
renderer.guessAndScore();

// assert
// Assert
expect(renderer).toHaveBeenAnsweredCorrectly();
});
it("can be answered incorrectly", () => {
Expand All @@ -95,17 +93,15 @@ describe("sorter widget", () => {
const {renderer} = renderQuestion(question1, apiOptions);
const sorter = renderer.findWidgets("sorter 1")[0];

// Act
// Put the options in the reverse order
["$0.005$ kilograms", "$15$ grams", "$55$ grams"].forEach(
(option, index) => {
act(() => sorter.moveOptionToIndex(option, 0));
},
);

// Act
renderer.guessAndScore();

// assert
// Assert
expect(renderer).toHaveBeenAnsweredIncorrectly();
});
});
2 changes: 2 additions & 0 deletions packages/perseus/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export {default as ServerItemRenderer} from "./server-item-renderer";
export {default as HintsRenderer} from "./hints-renderer";
export {default as HintRenderer} from "./hint-renderer";
export {default as Renderer} from "./renderer";
export {scorePerseusItem} from "./renderer-util";

/**
* Widgets
Expand Down Expand Up @@ -224,6 +225,7 @@ export type {
PerseusWidgetsMap,
MultiItem,
} from "./perseus-types";
export type {UserInputMap} from "./validation.types";
export type {Coord} from "./interactive2/types";
export type {MarkerType} from "./widgets/label-image/types";

Expand Down
4 changes: 2 additions & 2 deletions packages/perseus/src/interactive2/objective_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const mapObject = function <K extends string, V, U>(
lambda: (arg1: V, arg2: K) => U,
): Record<K, U> {
const result: Record<string, any> = {};
_.each(_.keys(obj), function (key) {
Object.keys(obj).forEach((key) => {
// @ts-expect-error - TS2345 - Argument of type 'string' is not assignable to parameter of type 'K'.
result[key] = lambda(obj[key], key);
});
Expand All @@ -66,7 +66,7 @@ const mapObjectFromArray = function <K extends string, V>(
lambda: (arg1: K) => V,
): Record<K, V> {
const result: Record<string, any> = {};
_.each(arr, function (elem) {
arr.forEach((elem) => {
result[elem] = lambda(elem);
});
return result;
Expand Down
Loading

0 comments on commit 07ac191

Please sign in to comment.