@khanacademy/perseus 12.0.1 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/es/index.css +2 -2
- package/dist/es/index.js +9 -3
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/item-renderer.test.tsx +1 -19
- package/src/styles/widgets/image.less +2 -6
- package/src/widgets/__stories__/image.stories.tsx +1 -0
- package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +1 -0
- package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +2 -0
- package/src/widgets/image.tsx +12 -2
- package/tsconfig-build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Core Perseus API (includes renderers and widgets)",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "12.0
|
|
6
|
+
"version": "12.1.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@khanacademy/kas": "^0.3.3",
|
|
26
26
|
"@khanacademy/kmath": "^0.1.4",
|
|
27
|
-
"@khanacademy/math-input": "^14.
|
|
27
|
+
"@khanacademy/math-input": "^14.2.0",
|
|
28
28
|
"@khanacademy/perseus-core": "1.1.2",
|
|
29
29
|
"@khanacademy/perseus-linter": "^0.3.6",
|
|
30
30
|
"@khanacademy/pure-markdown": "^0.2.8",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"jquery": "^2.1.1",
|
|
58
58
|
"katex": "^0.11.1",
|
|
59
59
|
"lodash.debounce": "^4.0.8",
|
|
60
|
-
"mathquill": "git+https://git@github.com/Khan/mathquill.git#
|
|
60
|
+
"mathquill": "git+https://git@github.com/Khan/mathquill.git#48410e80d760bbd5105544d4a4ab459a28dc2cbc",
|
|
61
61
|
"perseus-build-settings": "^0.2.1",
|
|
62
62
|
"prop-types": "^15.6.1",
|
|
63
63
|
"react": "16.14.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {StatefulKeypadContextProvider} from "@khanacademy/math-input";
|
|
2
2
|
import {RenderStateRoot} from "@khanacademy/wonder-blocks-core";
|
|
3
|
-
import {fireEvent, render, screen
|
|
3
|
+
import {fireEvent, render, screen} from "@testing-library/react";
|
|
4
4
|
import userEvent from "@testing-library/user-event";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import "@testing-library/jest-dom"; // Imports custom matchers
|
|
@@ -88,7 +88,6 @@ export const renderQuestion = (
|
|
|
88
88
|
area. Without both of these, it fails to render anything! */}
|
|
89
89
|
<div id="workarea" />
|
|
90
90
|
<div id="hintsarea" />
|
|
91
|
-
|
|
92
91
|
<Peripherals />
|
|
93
92
|
</StatefulKeypadContextProvider>
|
|
94
93
|
</RenderStateRoot>,
|
|
@@ -312,23 +311,6 @@ describe("item renderer", () => {
|
|
|
312
311
|
);
|
|
313
312
|
});
|
|
314
313
|
|
|
315
|
-
it("should activate the keypad when widget with input is focused", async () => {
|
|
316
|
-
// Arrange
|
|
317
|
-
const {renderer} = renderQuestion(itemWithInput, {
|
|
318
|
-
isMobile: true,
|
|
319
|
-
customKeypad: true,
|
|
320
|
-
useV2Keypad: true,
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
// Act
|
|
324
|
-
renderer.focus();
|
|
325
|
-
|
|
326
|
-
// Assert
|
|
327
|
-
await waitFor(() => {
|
|
328
|
-
expect(screen.getByLabelText("7")).toBeVisible();
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
|
|
332
314
|
it("should provide current and previous focus paths on focus change to, and away from, a single widget", () => {
|
|
333
315
|
// Arrange
|
|
334
316
|
const onFocusChange = jest.fn();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.perseus-image-widget {
|
|
2
|
-
margin:
|
|
2
|
+
margin-left: auto;
|
|
3
|
+
margin-right: auto;
|
|
3
4
|
|
|
4
5
|
.perseus-image-title {
|
|
5
6
|
text-align: center;
|
|
@@ -10,11 +11,6 @@
|
|
|
10
11
|
padding-left: 16px;
|
|
11
12
|
position: relative;
|
|
12
13
|
|
|
13
|
-
// This offsets the paragraph's padding
|
|
14
|
-
// So that the caption sits much closer
|
|
15
|
-
// to the image
|
|
16
|
-
top: -12px;
|
|
17
|
-
|
|
18
14
|
&::before {
|
|
19
15
|
content: "";
|
|
20
16
|
position: absolute;
|
|
@@ -72,6 +72,7 @@ export const Question2 = (args: StoryArgs): React.ReactElement => {
|
|
|
72
72
|
imageOptions != null
|
|
73
73
|
? {
|
|
74
74
|
...imageOptions,
|
|
75
|
+
alignment: "full-width",
|
|
75
76
|
title: args.title,
|
|
76
77
|
caption:
|
|
77
78
|
"There is neither happiness nor unhappiness in this world; there is only the comparison of one state with another. Only a man who has felt ultimate despair is capable of feeling ultimate bliss. It is necessary to have wished for death in order to know how good it is to live.....the sum of all human wisdom will be contained in these two words: Wait and Hope",
|
|
@@ -26,6 +26,7 @@ exports[`image widget - isMobile %b should snapshot: first render 1`] = `
|
|
|
26
26
|
>
|
|
27
27
|
<figure
|
|
28
28
|
class="perseus-image-widget"
|
|
29
|
+
style="max-width: 420px;"
|
|
29
30
|
>
|
|
30
31
|
<div
|
|
31
32
|
class="fixed-to-responsive svg-image"
|
|
@@ -207,6 +208,7 @@ exports[`image widget - isMobile %b should snapshot: first render 2`] = `
|
|
|
207
208
|
>
|
|
208
209
|
<figure
|
|
209
210
|
class="perseus-image-widget"
|
|
211
|
+
style="max-width: 420px;"
|
|
210
212
|
>
|
|
211
213
|
<div
|
|
212
214
|
class="perseus-image-title"
|
package/src/widgets/image.tsx
CHANGED
|
@@ -220,7 +220,12 @@ class ImageWidget extends React.Component<Props> {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
return (
|
|
223
|
-
<figure
|
|
223
|
+
<figure
|
|
224
|
+
className="perseus-image-widget"
|
|
225
|
+
style={{
|
|
226
|
+
maxWidth: backgroundImage.width,
|
|
227
|
+
}}
|
|
228
|
+
>
|
|
224
229
|
{image}
|
|
225
230
|
{alt}
|
|
226
231
|
{titleAndCaption}
|
|
@@ -260,7 +265,12 @@ class ImageWidget extends React.Component<Props> {
|
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
return (
|
|
263
|
-
<figure
|
|
268
|
+
<figure
|
|
269
|
+
className="perseus-image-widget"
|
|
270
|
+
style={{
|
|
271
|
+
maxWidth: backgroundImage.width,
|
|
272
|
+
}}
|
|
273
|
+
>
|
|
264
274
|
{title}
|
|
265
275
|
{image}
|
|
266
276
|
{alt}
|