@khanacademy/perseus 4.0.2 → 6.0.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 +57 -0
- package/dist/components/fixed-to-responsive.d.ts +27 -1
- package/dist/components/fixed-to-responsive.js.flow +27 -1
- package/dist/components/graph.d.ts +42 -26
- package/dist/components/graph.js.flow +42 -28
- package/dist/components/graphie.d.ts +34 -22
- package/dist/components/graphie.js.flow +37 -24
- package/dist/components/highlighting/highlightable-content.d.ts +4 -4
- package/dist/components/highlighting/highlightable-content.js.flow +4 -7
- package/dist/components/highlighting/ui/highlight-renderer.d.ts +6 -6
- package/dist/components/highlighting/ui/highlight-renderer.js.flow +6 -8
- package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +5 -5
- package/dist/components/highlighting/ui/highlight-set-renderer.js.flow +5 -8
- package/dist/components/highlighting/ui/highlight-tooltip.d.ts +2 -2
- package/dist/components/highlighting/ui/highlight-tooltip.js.flow +2 -4
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +2 -2
- package/dist/components/highlighting/ui/highlighting-ui.js.flow +2 -2
- package/dist/components/highlighting/ui/selection-tracker.d.ts +5 -5
- package/dist/components/highlighting/ui/selection-tracker.js.flow +5 -7
- package/dist/components/highlighting/word-indexer.d.ts +2 -2
- package/dist/components/highlighting/word-indexer.js.flow +2 -2
- package/dist/components/hud.d.ts +8 -14
- package/dist/components/hud.js.flow +7 -14
- package/dist/components/inline-icon.d.ts +27 -3
- package/dist/components/inline-icon.js.flow +26 -3
- package/dist/components/lint.d.ts +41 -13
- package/dist/components/lint.js.flow +42 -13
- package/dist/components/math-output.d.ts +15 -11
- package/dist/components/math-output.js.flow +15 -11
- package/dist/components/simple-keypad-input.d.ts +1 -1
- package/dist/components/simple-keypad-input.js.flow +1 -1
- package/dist/components/sortable.d.ts +17 -9
- package/dist/components/sortable.js.flow +22 -9
- package/dist/components/svg-image.d.ts +5 -3
- package/dist/components/svg-image.js.flow +5 -3
- package/dist/components/tex-buttons.d.ts +2 -2
- package/dist/components/tex-buttons.js.flow +2 -2
- package/dist/components/tooltip.d.ts +45 -4
- package/dist/components/tooltip.js.flow +44 -31
- package/dist/error-boundary.d.ts +4 -4
- package/dist/error-boundary.js.flow +4 -6
- package/dist/es/index.css +0 -3
- package/dist/es/index.js +484 -658
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +0 -3
- package/dist/index.js +488 -655
- package/dist/index.js.map +1 -1
- package/dist/perseus-types.d.ts +11 -10
- package/dist/perseus-types.js.flow +11 -10
- package/dist/renderer.d.ts +2 -2
- package/dist/renderer.js.flow +1 -3
- package/dist/styles/shared.d.ts +0 -1
- package/dist/styles/shared.js.flow +0 -1
- package/dist/types.d.ts +0 -10
- package/dist/types.js.flow +0 -13
- package/dist/util/a11y.d.ts +0 -1
- package/dist/util/a11y.js.flow +0 -1
- package/dist/util/interactive.d.ts +2 -0
- package/dist/util/interactive.js.flow +2 -0
- package/dist/util.d.ts +3 -3
- package/dist/util.js.flow +4 -3
- package/dist/widgets/__stories__/test-keypad-context-wrapper.d.ts +2 -2
- package/dist/widgets/__stories__/test-keypad-context-wrapper.js.flow +2 -4
- package/dist/widgets/expression.d.ts +2 -2
- package/dist/widgets/expression.js.flow +2 -2
- package/dist/widgets/grapher.d.ts +1 -1
- package/dist/widgets/grapher.js.flow +12 -3
- package/dist/widgets/interaction/element-container.d.ts +5 -4
- package/dist/widgets/interaction/element-container.js.flow +6 -11
- package/dist/widgets/label-image/marker.d.ts +4 -4
- package/dist/widgets/label-image/marker.js.flow +4 -6
- package/dist/widgets/matcher.d.ts +7 -3
- package/dist/widgets/matcher.js.flow +7 -3
- package/dist/widgets/number-line.d.ts +1 -1
- package/dist/widgets/number-line.js.flow +1 -1
- package/dist/widgets/numeric-input.d.ts +0 -2
- package/dist/widgets/numeric-input.js.flow +0 -4
- package/dist/widgets/radio/base-radio.d.ts +7 -1
- package/dist/widgets/radio/base-radio.js.flow +7 -1
- package/dist/widgets/radio/choice-icon/choice-icon.d.ts +1 -1
- package/dist/widgets/radio/choice-icon/choice-icon.js.flow +1 -1
- package/dist/widgets/radio/choice-icon/cross-out-line.d.ts +2 -2
- package/dist/widgets/radio/choice-icon/cross-out-line.js.flow +2 -2
- package/dist/widgets/radio/focus-ring.d.ts +8 -1
- package/dist/widgets/radio/focus-ring.js.flow +8 -1
- package/dist/widgets/radio/option-status.d.ts +2 -2
- package/dist/widgets/radio/option-status.js.flow +2 -2
- package/dist/widgets/video-transcript-link.d.ts +1 -1
- package/dist/widgets/video-transcript-link.js.flow +1 -1
- package/package.json +4 -4
- package/src/__stories__/item-renderer.stories.tsx +2 -6
- package/src/__stories__/server-item-renderer.stories.tsx +2 -6
- package/src/__tests__/__snapshots__/item-renderer.test.tsx.snap +151 -159
- package/src/__tests__/__snapshots__/renderer.test.tsx.snap +358 -394
- package/src/__tests__/__snapshots__/server-item-renderer.test.tsx.snap +169 -189
- package/src/components/__stories__/button-group.stories.tsx +2 -6
- package/src/components/__stories__/fixed-to-responsive.stories.tsx +14 -16
- package/src/components/__stories__/graph.stories.tsx +3 -5
- package/src/components/__stories__/graphie.stories.tsx +3 -5
- package/src/components/__stories__/hud.stories.tsx +2 -6
- package/src/components/__stories__/icon.stories.tsx +1 -1
- package/src/components/__stories__/image-loader.stories.tsx +4 -4
- package/src/components/__stories__/info-tip.stories.tsx +2 -6
- package/src/components/__stories__/inline-icon.stories.tsx +4 -8
- package/src/components/__stories__/input-with-examples.stories.tsx +6 -10
- package/src/components/__stories__/lint.stories.tsx +62 -27
- package/src/components/__stories__/math-input.stories.tsx +4 -8
- package/src/components/__stories__/math-output.stories.tsx +3 -5
- package/src/components/__stories__/multi-button-group.stories.tsx +2 -6
- package/src/components/__stories__/number-input.stories.tsx +6 -8
- package/src/components/__stories__/prop-check-box.stories.tsx +9 -9
- package/src/components/__stories__/range-input.stories.tsx +4 -6
- package/src/components/__stories__/simple-keypad-input.stories.tsx +2 -4
- package/src/components/__stories__/sortable.stories.tsx +20 -20
- package/src/components/__stories__/stub-tag-editor.stories.tsx +5 -9
- package/src/components/__stories__/svg-image.stories.tsx +10 -18
- package/src/components/__stories__/tex.stories.tsx +1 -3
- package/src/components/__stories__/text-buttons.stories.tsx +10 -22
- package/src/components/__stories__/text-input.stories.tsx +4 -10
- package/src/components/__stories__/text-list-editor.stories.tsx +1 -3
- package/src/components/__stories__/tooltip.stories.tsx +52 -0
- package/src/components/__stories__/zoomable-tex.stories.tsx +6 -4
- package/src/components/__stories__/zoomable.stories.tsx +1 -3
- package/src/components/__tests__/__snapshots__/sortable.test.tsx.snap +114 -30
- package/src/components/__tests__/__snapshots__/sorter.test.tsx.snap +172 -204
- package/src/components/__tests__/sortable.test.tsx +54 -16
- package/src/components/__tests__/sorter.test.tsx +12 -9
- package/src/components/fixed-to-responsive.tsx +43 -38
- package/src/components/graph.tsx +95 -81
- package/src/components/graphie.tsx +62 -32
- package/src/components/highlighting/highlightable-content.tsx +4 -7
- package/src/components/highlighting/ui/highlight-renderer.tsx +6 -9
- package/src/components/highlighting/ui/highlight-set-renderer.tsx +5 -8
- package/src/components/highlighting/ui/highlight-tooltip.tsx +2 -2
- package/src/components/highlighting/ui/highlighting-ui.tsx +2 -2
- package/src/components/highlighting/ui/selection-tracker.tsx +5 -8
- package/src/components/highlighting/word-indexer.tsx +2 -2
- package/src/components/hud.tsx +104 -115
- package/src/components/inline-icon.tsx +17 -34
- package/src/components/input-with-examples.tsx +4 -4
- package/src/components/lint.tsx +47 -41
- package/src/components/math-output.tsx +17 -11
- package/src/components/simple-keypad-input.tsx +4 -4
- package/src/components/sortable.tsx +134 -94
- package/src/components/svg-image.tsx +10 -11
- package/src/components/tex-buttons.tsx +2 -2
- package/src/components/tooltip.tsx +189 -171
- package/src/components/visibility-observer/__stories__/visibility-observer.stories.tsx +1 -3
- package/src/error-boundary.tsx +4 -7
- package/src/interactive2/types.ts +2 -2
- package/src/multi-items/__stories__/multi-renderer.stories.tsx +1 -1
- package/src/multi-items/__tests__/__snapshots__/multi-renderer.test.tsx.snap +708 -764
- package/src/multi-items/__tests__/multi-renderer.test.tsx +2 -3
- package/src/perseus-types.ts +13 -12
- package/src/renderer.tsx +11 -22
- package/src/types.ts +0 -18
- package/src/util/graphie.ts +3 -3
- package/src/util/interactive.ts +18 -5
- package/src/util/tex.ts +13 -77
- package/src/util.ts +3 -4
- package/src/widgets/__stories__/categorizer.stories.tsx +1 -1
- package/src/widgets/__stories__/cs-program.stories.tsx +1 -1
- package/src/widgets/__stories__/definition.stories.tsx +3 -7
- package/src/widgets/__stories__/dropdown.stories.tsx +1 -1
- package/src/widgets/__stories__/explanation.stories.tsx +2 -2
- package/src/widgets/__stories__/expression.stories.tsx +5 -11
- package/src/widgets/__stories__/graded-group-set.stories.tsx +1 -1
- package/src/widgets/__stories__/graded-group.stories.tsx +1 -1
- package/src/widgets/__stories__/grapher.stories.tsx +7 -21
- package/src/widgets/__stories__/group.stories.tsx +1 -1
- package/src/widgets/__stories__/iframe.stories.tsx +1 -1
- package/src/widgets/__stories__/image.stories.tsx +1 -1
- package/src/widgets/__stories__/input-number.stories.tsx +3 -12
- package/src/widgets/__stories__/interaction.stories.tsx +1 -1
- package/src/widgets/__stories__/interactive-graph.stories.tsx +9 -9
- package/src/widgets/__stories__/matcher.stories.tsx +1 -1
- package/src/widgets/__stories__/matrix.stories.tsx +1 -1
- package/src/widgets/__stories__/number-line.stories.tsx +1 -1
- package/src/widgets/__stories__/numeric-input.stories.tsx +3 -5
- package/src/widgets/__stories__/orderer.stories.tsx +1 -1
- package/src/widgets/__stories__/passage-ref.stories.tsx +2 -2
- package/src/widgets/__stories__/passage.stories.tsx +3 -9
- package/src/widgets/__stories__/radio.stories.tsx +3 -5
- package/src/widgets/__stories__/sorter.stories.tsx +1 -1
- package/src/widgets/__stories__/test-keypad-context-wrapper.tsx +2 -4
- package/src/widgets/__stories__/transformer.stories.tsx +1 -1
- package/src/widgets/__stories__/unit.stories.tsx +1 -3
- package/src/widgets/__stories__/video-transcript-link.stories.tsx +2 -6
- package/src/widgets/__stories__/video.stories.tsx +1 -1
- package/src/widgets/__testdata__/group.testdata.ts +0 -2
- package/src/widgets/__tests__/__snapshots__/categorizer.test.ts.snap +717 -773
- package/src/widgets/__tests__/__snapshots__/cs-program.test.ts.snap +28 -36
- package/src/widgets/__tests__/__snapshots__/definition.test.ts.snap +52 -60
- package/src/widgets/__tests__/__snapshots__/dropdown.test.ts.snap +100 -108
- package/src/widgets/__tests__/__snapshots__/explanation.test.ts.snap +212 -260
- package/src/widgets/__tests__/__snapshots__/graded-group-set-jipt.test.ts.snap +613 -641
- package/src/widgets/__tests__/__snapshots__/graded-group-set.test.ts.snap +249 -261
- package/src/widgets/__tests__/__snapshots__/graded-group.test.ts.snap +671 -735
- package/src/widgets/__tests__/__snapshots__/grapher.test.ts.snap +2676 -2684
- package/src/widgets/__tests__/__snapshots__/group.test.tsx.snap +938 -1002
- package/src/widgets/__tests__/__snapshots__/iframe.test.ts.snap +28 -36
- package/src/widgets/__tests__/__snapshots__/image.test.ts.snap +227 -255
- package/src/widgets/__tests__/__snapshots__/input-number.test.ts.snap +353 -357
- package/src/widgets/__tests__/__snapshots__/interaction.test.ts.snap +255 -259
- package/src/widgets/__tests__/__snapshots__/interactive-graph.test.ts.snap +2401 -2433
- package/src/widgets/__tests__/__snapshots__/matcher.test.tsx.snap +600 -756
- package/src/widgets/__tests__/__snapshots__/matrix.test.ts.snap +420 -428
- package/src/widgets/__tests__/__snapshots__/number-line.test.ts.snap +762 -770
- package/src/widgets/__tests__/__snapshots__/numeric-input.test.ts.snap +373 -393
- package/src/widgets/__tests__/__snapshots__/orderer.test.ts.snap +116 -148
- package/src/widgets/__tests__/__snapshots__/passage-ref.test.ts.snap +289 -301
- package/src/widgets/__tests__/__snapshots__/passage.test.tsx.snap +1679 -1711
- package/src/widgets/__tests__/__snapshots__/radio.test.ts.snap +2692 -2960
- package/src/widgets/__tests__/__snapshots__/video.test.ts.snap +90 -98
- package/src/widgets/__tests__/group.test.tsx +0 -2
- package/src/widgets/__tests__/matcher.test.tsx +33 -9
- package/src/widgets/__tests__/radio/focus-ring.test.tsx +0 -1
- package/src/widgets/expression.tsx +12 -9
- package/src/widgets/grapher.tsx +3 -3
- package/src/widgets/image.tsx +2 -2
- package/src/widgets/interaction/element-container.tsx +7 -8
- package/src/widgets/interactive-graph.tsx +5 -5
- package/src/widgets/label-image/__stories__/answer-choices.stories.tsx +2 -4
- package/src/widgets/label-image/__stories__/marker.stories.tsx +9 -19
- package/src/widgets/label-image/marker.tsx +4 -4
- package/src/widgets/matcher.tsx +43 -24
- package/src/widgets/number-line.tsx +1 -1
- package/src/widgets/numeric-input.tsx +0 -3
- package/src/widgets/passage/passage-markdown.tsx +2 -2
- package/src/widgets/radio/__stories__/base-radio.stories.tsx +11 -19
- package/src/widgets/radio/__stories__/choice-icon.stories.tsx +9 -11
- package/src/widgets/radio/__stories__/choice-none-above.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/choice.stories.tsx +4 -4
- package/src/widgets/radio/__stories__/focus-ring.stories.tsx +1 -1
- package/src/widgets/radio/__stories__/option-status.stories.tsx +2 -4
- package/src/widgets/radio/base-radio.tsx +1 -1
- package/src/widgets/radio/choice-icon/choice-icon.tsx +5 -5
- package/src/widgets/radio/choice-icon/cross-out-line.tsx +1 -3
- package/src/widgets/radio/choice-none-above.tsx +2 -2
- package/src/widgets/radio/choice.tsx +1 -3
- package/src/widgets/radio/focus-ring.tsx +1 -1
- package/src/widgets/radio/option-status.tsx +2 -4
- package/src/widgets/radio/widget.tsx +0 -1
- package/src/widgets/reaction-diagram.tsx +2 -2
- package/src/widgets/simulator.tsx +4 -6
- package/src/widgets/video-transcript-link.tsx +1 -1
- package/{tsconfig.json → tsconfig-build.json} +6 -6
- package/tsconfig-build.tsbuildinfo +1 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -2,296 +2,264 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`sorter widget should snapshot on mobile: first mobile render 1`] = `
|
|
4
4
|
<div>
|
|
5
|
-
<
|
|
6
|
-
class="
|
|
5
|
+
<div
|
|
6
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
class="
|
|
9
|
+
class="paragraph"
|
|
10
|
+
data-perseus-paragraph-index="0"
|
|
10
11
|
>
|
|
11
12
|
<div
|
|
12
13
|
class="paragraph"
|
|
13
|
-
data-perseus-paragraph-index="0"
|
|
14
14
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
>
|
|
18
|
-
<strong>
|
|
19
|
-
Arrange the following measurements in order from smallest to largest.
|
|
20
|
-
</strong>
|
|
21
|
-
</div>
|
|
15
|
+
<strong>
|
|
16
|
+
Arrange the following measurements in order from smallest to largest.
|
|
17
|
+
</strong>
|
|
22
18
|
</div>
|
|
19
|
+
</div>
|
|
20
|
+
<div
|
|
21
|
+
class="paragraph"
|
|
22
|
+
data-perseus-paragraph-index="1"
|
|
23
|
+
>
|
|
23
24
|
<div
|
|
24
25
|
class="paragraph"
|
|
25
|
-
data-perseus-paragraph-index="1"
|
|
26
26
|
>
|
|
27
27
|
<div
|
|
28
|
-
class="
|
|
28
|
+
class="perseus-widget-container widget-nohighlight widget-block"
|
|
29
29
|
>
|
|
30
30
|
<div
|
|
31
|
-
class="perseus-widget-
|
|
31
|
+
class="perseus-widget-sorter perseus-clearfix"
|
|
32
32
|
>
|
|
33
|
-
<
|
|
34
|
-
class="
|
|
33
|
+
<ul
|
|
34
|
+
class="sortable_13d4756 perseus-sortable"
|
|
35
35
|
>
|
|
36
|
-
<
|
|
37
|
-
class="
|
|
36
|
+
<li
|
|
37
|
+
class="card_1s6cuhy-o_O-draggable_12to336-o_O-horizontalCard_9um937 perseus-interactive perseus-sortable-draggable"
|
|
38
|
+
style="position: static; margin: 0px 8px 0px 0px;"
|
|
38
39
|
>
|
|
39
|
-
<
|
|
40
|
-
class="
|
|
41
|
-
style="position: static; margin: 0px 8px 0px 0px;"
|
|
40
|
+
<div
|
|
41
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
42
42
|
>
|
|
43
|
-
<
|
|
44
|
-
class="
|
|
43
|
+
<div
|
|
44
|
+
class="paragraph"
|
|
45
|
+
data-perseus-paragraph-index="0"
|
|
45
46
|
>
|
|
46
47
|
<div
|
|
47
|
-
class="
|
|
48
|
+
class="paragraph"
|
|
48
49
|
>
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
data-perseus-paragraph-index="0"
|
|
50
|
+
<span
|
|
51
|
+
style="white-space: nowrap;"
|
|
52
52
|
>
|
|
53
|
-
<
|
|
54
|
-
|
|
53
|
+
<span />
|
|
54
|
+
<span
|
|
55
|
+
class="tex-mock"
|
|
55
56
|
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class="tex-mock"
|
|
62
|
-
>
|
|
63
|
-
15
|
|
64
|
-
</span>
|
|
65
|
-
<span />
|
|
66
|
-
</span>
|
|
67
|
-
grams
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
57
|
+
15
|
|
58
|
+
</span>
|
|
59
|
+
<span />
|
|
60
|
+
</span>
|
|
61
|
+
grams
|
|
70
62
|
</div>
|
|
71
|
-
</
|
|
72
|
-
</
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</li>
|
|
66
|
+
<li
|
|
67
|
+
class="card_1s6cuhy-o_O-draggable_12to336-o_O-horizontalCard_9um937 perseus-interactive perseus-sortable-draggable"
|
|
68
|
+
style="position: static; margin: 0px 8px 0px 0px;"
|
|
69
|
+
>
|
|
70
|
+
<div
|
|
71
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
76
72
|
>
|
|
77
|
-
<
|
|
78
|
-
class="
|
|
73
|
+
<div
|
|
74
|
+
class="paragraph"
|
|
75
|
+
data-perseus-paragraph-index="0"
|
|
79
76
|
>
|
|
80
77
|
<div
|
|
81
|
-
class="
|
|
78
|
+
class="paragraph"
|
|
82
79
|
>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
data-perseus-paragraph-index="0"
|
|
80
|
+
<span
|
|
81
|
+
style="white-space: nowrap;"
|
|
86
82
|
>
|
|
87
|
-
<
|
|
88
|
-
|
|
83
|
+
<span />
|
|
84
|
+
<span
|
|
85
|
+
class="tex-mock"
|
|
89
86
|
>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class="tex-mock"
|
|
96
|
-
>
|
|
97
|
-
0.005
|
|
98
|
-
</span>
|
|
99
|
-
<span />
|
|
100
|
-
</span>
|
|
101
|
-
kilograms
|
|
102
|
-
</div>
|
|
103
|
-
</div>
|
|
87
|
+
0.005
|
|
88
|
+
</span>
|
|
89
|
+
<span />
|
|
90
|
+
</span>
|
|
91
|
+
kilograms
|
|
104
92
|
</div>
|
|
105
|
-
</
|
|
106
|
-
</
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</li>
|
|
96
|
+
<li
|
|
97
|
+
class="card_1s6cuhy-o_O-draggable_12to336-o_O-horizontalCard_9um937 perseus-interactive perseus-sortable-draggable"
|
|
98
|
+
style="position: static; margin: 0px;"
|
|
99
|
+
>
|
|
100
|
+
<div
|
|
101
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
110
102
|
>
|
|
111
|
-
<
|
|
112
|
-
class="
|
|
103
|
+
<div
|
|
104
|
+
class="paragraph"
|
|
105
|
+
data-perseus-paragraph-index="0"
|
|
113
106
|
>
|
|
114
107
|
<div
|
|
115
|
-
class="
|
|
108
|
+
class="paragraph"
|
|
116
109
|
>
|
|
117
|
-
<
|
|
118
|
-
|
|
119
|
-
data-perseus-paragraph-index="0"
|
|
110
|
+
<span
|
|
111
|
+
style="white-space: nowrap;"
|
|
120
112
|
>
|
|
121
|
-
<
|
|
122
|
-
|
|
113
|
+
<span />
|
|
114
|
+
<span
|
|
115
|
+
class="tex-mock"
|
|
123
116
|
>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
class="tex-mock"
|
|
130
|
-
>
|
|
131
|
-
55
|
|
132
|
-
</span>
|
|
133
|
-
<span />
|
|
134
|
-
</span>
|
|
135
|
-
grams
|
|
136
|
-
</div>
|
|
137
|
-
</div>
|
|
117
|
+
55
|
|
118
|
+
</span>
|
|
119
|
+
<span />
|
|
120
|
+
</span>
|
|
121
|
+
grams
|
|
138
122
|
</div>
|
|
139
|
-
</
|
|
140
|
-
</
|
|
141
|
-
</
|
|
142
|
-
</
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</li>
|
|
126
|
+
</ul>
|
|
143
127
|
</div>
|
|
144
128
|
</div>
|
|
145
129
|
</div>
|
|
146
130
|
</div>
|
|
147
|
-
</
|
|
131
|
+
</div>
|
|
148
132
|
</div>
|
|
149
133
|
`;
|
|
150
134
|
|
|
151
135
|
exports[`sorter widget should snapshot: first render 1`] = `
|
|
152
136
|
<div>
|
|
153
|
-
<
|
|
154
|
-
class="
|
|
137
|
+
<div
|
|
138
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
155
139
|
>
|
|
156
140
|
<div
|
|
157
|
-
class="
|
|
141
|
+
class="paragraph"
|
|
142
|
+
data-perseus-paragraph-index="0"
|
|
158
143
|
>
|
|
159
144
|
<div
|
|
160
145
|
class="paragraph"
|
|
161
|
-
data-perseus-paragraph-index="0"
|
|
162
146
|
>
|
|
163
|
-
<
|
|
164
|
-
|
|
165
|
-
>
|
|
166
|
-
<strong>
|
|
167
|
-
Arrange the following measurements in order from smallest to largest.
|
|
168
|
-
</strong>
|
|
169
|
-
</div>
|
|
147
|
+
<strong>
|
|
148
|
+
Arrange the following measurements in order from smallest to largest.
|
|
149
|
+
</strong>
|
|
170
150
|
</div>
|
|
151
|
+
</div>
|
|
152
|
+
<div
|
|
153
|
+
class="paragraph"
|
|
154
|
+
data-perseus-paragraph-index="1"
|
|
155
|
+
>
|
|
171
156
|
<div
|
|
172
157
|
class="paragraph"
|
|
173
|
-
data-perseus-paragraph-index="1"
|
|
174
158
|
>
|
|
175
159
|
<div
|
|
176
|
-
class="
|
|
160
|
+
class="perseus-widget-container widget-nohighlight widget-block"
|
|
177
161
|
>
|
|
178
162
|
<div
|
|
179
|
-
class="perseus-widget-
|
|
163
|
+
class="perseus-widget-sorter perseus-clearfix"
|
|
180
164
|
>
|
|
181
|
-
<
|
|
182
|
-
class="
|
|
165
|
+
<ul
|
|
166
|
+
class="sortable_13d4756 perseus-sortable"
|
|
183
167
|
>
|
|
184
|
-
<
|
|
185
|
-
class="
|
|
168
|
+
<li
|
|
169
|
+
class="card_1s6cuhy-o_O-draggable_12to336-o_O-horizontalCard_9um937 perseus-interactive perseus-sortable-draggable"
|
|
170
|
+
style="position: static; margin: 0px 5px 0px 0px;"
|
|
186
171
|
>
|
|
187
|
-
<
|
|
188
|
-
class="
|
|
189
|
-
style="position: static; margin: 0px 5px 0px 0px;"
|
|
172
|
+
<div
|
|
173
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
190
174
|
>
|
|
191
|
-
<
|
|
192
|
-
class="
|
|
175
|
+
<div
|
|
176
|
+
class="paragraph"
|
|
177
|
+
data-perseus-paragraph-index="0"
|
|
193
178
|
>
|
|
194
179
|
<div
|
|
195
|
-
class="
|
|
180
|
+
class="paragraph"
|
|
196
181
|
>
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
data-perseus-paragraph-index="0"
|
|
182
|
+
<span
|
|
183
|
+
style="white-space: nowrap;"
|
|
200
184
|
>
|
|
201
|
-
<
|
|
202
|
-
|
|
185
|
+
<span />
|
|
186
|
+
<span
|
|
187
|
+
class="tex-mock"
|
|
203
188
|
>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
class="tex-mock"
|
|
210
|
-
>
|
|
211
|
-
15
|
|
212
|
-
</span>
|
|
213
|
-
<span />
|
|
214
|
-
</span>
|
|
215
|
-
grams
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
189
|
+
15
|
|
190
|
+
</span>
|
|
191
|
+
<span />
|
|
192
|
+
</span>
|
|
193
|
+
grams
|
|
218
194
|
</div>
|
|
219
|
-
</
|
|
220
|
-
</
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
</li>
|
|
198
|
+
<li
|
|
199
|
+
class="card_1s6cuhy-o_O-draggable_12to336-o_O-horizontalCard_9um937 perseus-interactive perseus-sortable-draggable"
|
|
200
|
+
style="position: static; margin: 0px 5px 0px 0px;"
|
|
201
|
+
>
|
|
202
|
+
<div
|
|
203
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
224
204
|
>
|
|
225
|
-
<
|
|
226
|
-
class="
|
|
205
|
+
<div
|
|
206
|
+
class="paragraph"
|
|
207
|
+
data-perseus-paragraph-index="0"
|
|
227
208
|
>
|
|
228
209
|
<div
|
|
229
|
-
class="
|
|
210
|
+
class="paragraph"
|
|
230
211
|
>
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
data-perseus-paragraph-index="0"
|
|
212
|
+
<span
|
|
213
|
+
style="white-space: nowrap;"
|
|
234
214
|
>
|
|
235
|
-
<
|
|
236
|
-
|
|
215
|
+
<span />
|
|
216
|
+
<span
|
|
217
|
+
class="tex-mock"
|
|
237
218
|
>
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
class="tex-mock"
|
|
244
|
-
>
|
|
245
|
-
0.005
|
|
246
|
-
</span>
|
|
247
|
-
<span />
|
|
248
|
-
</span>
|
|
249
|
-
kilograms
|
|
250
|
-
</div>
|
|
251
|
-
</div>
|
|
219
|
+
0.005
|
|
220
|
+
</span>
|
|
221
|
+
<span />
|
|
222
|
+
</span>
|
|
223
|
+
kilograms
|
|
252
224
|
</div>
|
|
253
|
-
</
|
|
254
|
-
</
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
</li>
|
|
228
|
+
<li
|
|
229
|
+
class="card_1s6cuhy-o_O-draggable_12to336-o_O-horizontalCard_9um937 perseus-interactive perseus-sortable-draggable"
|
|
230
|
+
style="position: static; margin: 0px;"
|
|
231
|
+
>
|
|
232
|
+
<div
|
|
233
|
+
class="perseus-renderer perseus-renderer-responsive"
|
|
258
234
|
>
|
|
259
|
-
<
|
|
260
|
-
class="
|
|
235
|
+
<div
|
|
236
|
+
class="paragraph"
|
|
237
|
+
data-perseus-paragraph-index="0"
|
|
261
238
|
>
|
|
262
239
|
<div
|
|
263
|
-
class="
|
|
240
|
+
class="paragraph"
|
|
264
241
|
>
|
|
265
|
-
<
|
|
266
|
-
|
|
267
|
-
data-perseus-paragraph-index="0"
|
|
242
|
+
<span
|
|
243
|
+
style="white-space: nowrap;"
|
|
268
244
|
>
|
|
269
|
-
<
|
|
270
|
-
|
|
245
|
+
<span />
|
|
246
|
+
<span
|
|
247
|
+
class="tex-mock"
|
|
271
248
|
>
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
class="tex-mock"
|
|
278
|
-
>
|
|
279
|
-
55
|
|
280
|
-
</span>
|
|
281
|
-
<span />
|
|
282
|
-
</span>
|
|
283
|
-
grams
|
|
284
|
-
</div>
|
|
285
|
-
</div>
|
|
249
|
+
55
|
|
250
|
+
</span>
|
|
251
|
+
<span />
|
|
252
|
+
</span>
|
|
253
|
+
grams
|
|
286
254
|
</div>
|
|
287
|
-
</
|
|
288
|
-
</
|
|
289
|
-
</
|
|
290
|
-
</
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
</li>
|
|
258
|
+
</ul>
|
|
291
259
|
</div>
|
|
292
260
|
</div>
|
|
293
261
|
</div>
|
|
294
262
|
</div>
|
|
295
|
-
</
|
|
263
|
+
</div>
|
|
296
264
|
</div>
|
|
297
265
|
`;
|
|
@@ -4,7 +4,7 @@ import "@testing-library/jest-dom"; // Imports custom mathers
|
|
|
4
4
|
|
|
5
5
|
import {testDependencies} from "../../../../../testing/test-dependencies";
|
|
6
6
|
import * as Dependencies from "../../dependencies";
|
|
7
|
-
import Sortable from "../sortable";
|
|
7
|
+
import Sortable, {Layout} from "../sortable";
|
|
8
8
|
|
|
9
9
|
describe("Sortable", () => {
|
|
10
10
|
beforeEach(() => {
|
|
@@ -17,15 +17,53 @@ describe("Sortable", () => {
|
|
|
17
17
|
// Arrange and Act
|
|
18
18
|
const {container} = render(
|
|
19
19
|
<Sortable
|
|
20
|
-
layout=
|
|
20
|
+
layout={Layout.HORIZONTAL}
|
|
21
21
|
options={["a", "b", "c"]}
|
|
22
|
-
|
|
22
|
+
waitForTexRendererToLoad={false}
|
|
23
23
|
/>,
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
// Assert
|
|
27
27
|
expect(container).toMatchSnapshot("first render");
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
it("renders a spinner while waiting for the TeX renderer to load", () => {
|
|
31
|
+
let simulateFakeTeXRendering = () => {};
|
|
32
|
+
function FakeTeX({
|
|
33
|
+
children,
|
|
34
|
+
onRender,
|
|
35
|
+
}: {
|
|
36
|
+
children: string;
|
|
37
|
+
onRender?: () => unknown;
|
|
38
|
+
}) {
|
|
39
|
+
simulateFakeTeXRendering = onRender || simulateFakeTeXRendering;
|
|
40
|
+
return <div className="fake-tex">{children}</div>;
|
|
41
|
+
}
|
|
42
|
+
jest.spyOn(Dependencies, "getDependencies").mockReturnValue({
|
|
43
|
+
...testDependencies,
|
|
44
|
+
TeX: FakeTeX,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Act
|
|
48
|
+
const {container} = render(
|
|
49
|
+
<Sortable
|
|
50
|
+
waitForTexRendererToLoad={true}
|
|
51
|
+
layout={Layout.HORIZONTAL}
|
|
52
|
+
options={["a", "b", "c"]}
|
|
53
|
+
/>,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Assert
|
|
57
|
+
expect(container).toMatchSnapshot("first render: displays a spinner");
|
|
58
|
+
|
|
59
|
+
// Act
|
|
60
|
+
simulateFakeTeXRendering();
|
|
61
|
+
|
|
62
|
+
// Assert
|
|
63
|
+
expect(container).toMatchSnapshot(
|
|
64
|
+
"second render: displays the sortable",
|
|
65
|
+
);
|
|
66
|
+
});
|
|
29
67
|
});
|
|
30
68
|
|
|
31
69
|
describe("moveOptionToIndex", () => {
|
|
@@ -41,9 +79,9 @@ describe("moveOptionToIndex", () => {
|
|
|
41
79
|
render(
|
|
42
80
|
<Sortable
|
|
43
81
|
ref={(r) => (sortable = r)}
|
|
44
|
-
layout=
|
|
82
|
+
layout={Layout.HORIZONTAL}
|
|
45
83
|
options={["a", "b", "c"]}
|
|
46
|
-
|
|
84
|
+
waitForTexRendererToLoad={false}
|
|
47
85
|
/>,
|
|
48
86
|
);
|
|
49
87
|
|
|
@@ -64,9 +102,9 @@ describe("moveOptionToIndex", () => {
|
|
|
64
102
|
render(
|
|
65
103
|
<Sortable
|
|
66
104
|
ref={(r) => (sortable = r)}
|
|
67
|
-
layout=
|
|
105
|
+
layout={Layout.HORIZONTAL}
|
|
68
106
|
options={["a", "b", "c"]}
|
|
69
|
-
|
|
107
|
+
waitForTexRendererToLoad={false}
|
|
70
108
|
/>,
|
|
71
109
|
);
|
|
72
110
|
|
|
@@ -85,9 +123,9 @@ describe("moveOptionToIndex", () => {
|
|
|
85
123
|
render(
|
|
86
124
|
<Sortable
|
|
87
125
|
ref={(r) => (sortable = r)}
|
|
88
|
-
layout=
|
|
126
|
+
layout={Layout.HORIZONTAL}
|
|
89
127
|
options={["a", "b", "c"]}
|
|
90
|
-
|
|
128
|
+
waitForTexRendererToLoad={false}
|
|
91
129
|
/>,
|
|
92
130
|
);
|
|
93
131
|
|
|
@@ -106,9 +144,9 @@ describe("moveOptionToIndex", () => {
|
|
|
106
144
|
render(
|
|
107
145
|
<Sortable
|
|
108
146
|
ref={(r) => (sortable = r)}
|
|
109
|
-
layout=
|
|
147
|
+
layout={Layout.HORIZONTAL}
|
|
110
148
|
options={["a", "b", "c"]}
|
|
111
|
-
|
|
149
|
+
waitForTexRendererToLoad={false}
|
|
112
150
|
/>,
|
|
113
151
|
);
|
|
114
152
|
|
|
@@ -147,7 +185,7 @@ describe("Sortable.itemsFromProps", () => {
|
|
|
147
185
|
"height": 0,
|
|
148
186
|
"key": 0,
|
|
149
187
|
"option": "a",
|
|
150
|
-
"
|
|
188
|
+
"state": "static",
|
|
151
189
|
"width": 0,
|
|
152
190
|
},
|
|
153
191
|
{
|
|
@@ -155,7 +193,7 @@ describe("Sortable.itemsFromProps", () => {
|
|
|
155
193
|
"height": 0,
|
|
156
194
|
"key": 1,
|
|
157
195
|
"option": "b",
|
|
158
|
-
"
|
|
196
|
+
"state": "static",
|
|
159
197
|
"width": 0,
|
|
160
198
|
},
|
|
161
199
|
{
|
|
@@ -163,7 +201,7 @@ describe("Sortable.itemsFromProps", () => {
|
|
|
163
201
|
"height": 0,
|
|
164
202
|
"key": 2,
|
|
165
203
|
"option": "c",
|
|
166
|
-
"
|
|
204
|
+
"state": "static",
|
|
167
205
|
"width": 0,
|
|
168
206
|
},
|
|
169
207
|
]
|
|
@@ -182,7 +220,7 @@ describe("Sortable.itemsFromProps", () => {
|
|
|
182
220
|
|
|
183
221
|
// Assert
|
|
184
222
|
items.forEach((item) => {
|
|
185
|
-
expect(item.
|
|
223
|
+
expect(item.state).toBe("disabled");
|
|
186
224
|
});
|
|
187
225
|
});
|
|
188
226
|
it("sets the item type to static if disabled is false", () => {
|
|
@@ -197,7 +235,7 @@ describe("Sortable.itemsFromProps", () => {
|
|
|
197
235
|
|
|
198
236
|
// Assert
|
|
199
237
|
items.forEach((item) => {
|
|
200
|
-
expect(item.
|
|
238
|
+
expect(item.state).toBe("static");
|
|
201
239
|
});
|
|
202
240
|
});
|
|
203
241
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import getRenderA11yString from "katex/dist/contrib/render-a11y-string";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
import "@testing-library/jest-dom";
|
|
4
3
|
|
|
@@ -22,15 +21,19 @@ describe("sorter widget", () => {
|
|
|
22
21
|
|
|
23
22
|
jest.spyOn(Dependencies, "getDependencies").mockReturnValue({
|
|
24
23
|
...testDependencies,
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
TeX: ({
|
|
25
|
+
children,
|
|
26
|
+
// alias onRender to onLoad to quiet the overzealous testing-library linter
|
|
27
|
+
onRender: onLoad,
|
|
28
|
+
}: {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
onRender?: () => unknown;
|
|
31
|
+
}) => {
|
|
32
|
+
React.useLayoutEffect(() => {
|
|
33
|
+
onLoad?.();
|
|
34
|
+
}, [onLoad]);
|
|
35
|
+
return <span className="tex-mock">{children}</span>;
|
|
27
36
|
},
|
|
28
|
-
TeX: ({children}: {children: React.ReactNode}) => (
|
|
29
|
-
<span className="tex-mock">{children}</span>
|
|
30
|
-
),
|
|
31
|
-
// @ts-expect-error [FEI-5003] - TS2322 - Type 'Promise<any>' is not assignable to type '() => Promise<katexA11y>'.
|
|
32
|
-
getRenderA11yString: Promise.resolve(getRenderA11yString),
|
|
33
|
-
shouldUseFutureKaTeX: (flag: boolean) => {},
|
|
34
37
|
});
|
|
35
38
|
});
|
|
36
39
|
|