@khanacademy/perseus 1.3.2 → 1.3.4

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/es/index.css +12 -12
  3. package/dist/es/index.js +32 -26
  4. package/dist/es/index.js.map +1 -1
  5. package/dist/index.css +12 -12
  6. package/dist/index.js +32 -26
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/__tests__/__snapshots__/perseus-markdown_test.jsx.snap +111 -111
  10. package/src/__tests__/item-renderer_test.jsx +9 -9
  11. package/src/__tests__/jipt-paragraphs_test.js +3 -3
  12. package/src/__tests__/renderer_test.jsx +22 -22
  13. package/src/__tests__/server-item-renderer_test.jsx +7 -7
  14. package/src/components/__tests__/sortable_test.jsx +7 -7
  15. package/src/multi-items/__tests__/__snapshots__/multi-renderer_test.js.snap +5 -5
  16. package/src/multi-items/__tests__/multi-renderer_test.js +90 -90
  17. package/src/renderer.jsx +2 -2
  18. package/src/styles/articles.less +6 -6
  19. package/src/widgets/__tests__/__snapshots__/grapher_test.jsx.snap +68 -68
  20. package/src/widgets/__tests__/__snapshots__/group_test.jsx.snap +5 -5
  21. package/src/widgets/__tests__/__snapshots__/interaction_test.jsx.snap +5 -5
  22. package/src/widgets/__tests__/__snapshots__/interactive-graph_test.jsx.snap +2 -2
  23. package/src/widgets/__tests__/__snapshots__/passage_test.jsx.snap +2 -2
  24. package/src/widgets/__tests__/__snapshots__/radio_test.jsx.snap +52 -52
  25. package/src/widgets/__tests__/categorizer_test.jsx +5 -5
  26. package/src/widgets/__tests__/explanation_test.js +5 -5
  27. package/src/widgets/__tests__/graded-group-set_test.jsx +2 -2
  28. package/src/widgets/__tests__/group_test.jsx +49 -49
  29. package/src/widgets/__tests__/numeric-input_test.jsx +5 -5
  30. package/src/widgets/__tests__/passage_test.jsx +1 -1
  31. package/src/widgets/__tests__/radio/base-radio_test.jsx +28 -1
  32. package/src/widgets/categorizer.jsx +1 -1
  33. package/src/widgets/expression.jsx +6 -6
  34. package/src/widgets/input-number.jsx +4 -4
  35. package/src/widgets/numeric-input.jsx +5 -5
  36. package/src/widgets/radio/base-radio.jsx +8 -3
  37. package/src/widgets/radio/choice-icon/library-choice-icon.jsx +2 -2
  38. package/src/widgets/radio/choice.jsx +1 -1
  39. package/src/widgets/radio/widget.jsx +2 -2
@@ -144,24 +144,24 @@ describe("multi-item renderer", () => {
144
144
 
145
145
  // Assert
146
146
  expect(state).toMatchInlineSnapshot(`
147
- Object {
148
- "blurb": Object {},
149
- "hints": Array [
147
+ {
148
+ "blurb": {},
149
+ "hints": [
150
150
  null,
151
151
  null,
152
152
  null,
153
153
  ],
154
- "question": Object {
155
- "input-number 1": Object {
154
+ "question": {
155
+ "input-number 1": {
156
156
  "answerType": "number",
157
157
  "currentValue": "+42",
158
158
  "rightAlign": undefined,
159
159
  "simplify": "required",
160
160
  "size": "normal",
161
161
  },
162
- "radio 1": Object {
163
- "choiceStates": Array [
164
- Object {
162
+ "radio 1": {
163
+ "choiceStates": [
164
+ {
165
165
  "correctnessShown": false,
166
166
  "crossedOut": false,
167
167
  "highlighted": false,
@@ -170,7 +170,7 @@ describe("multi-item renderer", () => {
170
170
  "readOnly": false,
171
171
  "selected": false,
172
172
  },
173
- Object {
173
+ {
174
174
  "correctnessShown": false,
175
175
  "crossedOut": false,
176
176
  "highlighted": false,
@@ -179,7 +179,7 @@ describe("multi-item renderer", () => {
179
179
  "readOnly": false,
180
180
  "selected": false,
181
181
  },
182
- Object {
182
+ {
183
183
  "correctnessShown": false,
184
184
  "crossedOut": false,
185
185
  "highlighted": false,
@@ -188,7 +188,7 @@ describe("multi-item renderer", () => {
188
188
  "readOnly": false,
189
189
  "selected": true,
190
190
  },
191
- Object {
191
+ {
192
192
  "correctnessShown": false,
193
193
  "crossedOut": false,
194
194
  "highlighted": false,
@@ -197,7 +197,7 @@ describe("multi-item renderer", () => {
197
197
  "readOnly": false,
198
198
  "selected": false,
199
199
  },
200
- Object {
200
+ {
201
201
  "correctnessShown": false,
202
202
  "crossedOut": false,
203
203
  "highlighted": false,
@@ -207,14 +207,14 @@ describe("multi-item renderer", () => {
207
207
  "selected": false,
208
208
  },
209
209
  ],
210
- "choices": Array [
211
- Object {
210
+ "choices": [
211
+ {
212
212
  "clue": "Congruent triangles have the same side lengths.",
213
213
  "content": "A triangle with side lengths of $3$, $4$, and $5$",
214
214
  "correct": false,
215
215
  "originalIndex": 0,
216
216
  },
217
- Object {
217
+ {
218
218
  "clue": "Congruent triangles have the same side lengths.
219
219
 
220
220
  This choice is similar to triangle $ABC$.",
@@ -222,21 +222,21 @@ describe("multi-item renderer", () => {
222
222
  "correct": false,
223
223
  "originalIndex": 1,
224
224
  },
225
- Object {
225
+ {
226
226
  "clue": "Congruent triangles have the same side lengths.",
227
227
  "content": "A triangle with side lengths of $10$, $12$, and $18$",
228
228
  "correct": false,
229
229
  "isNoneOfTheAbove": false,
230
230
  "originalIndex": 2,
231
231
  },
232
- Object {
232
+ {
233
233
  "clue": "Congruent triangles have the same side lengths.",
234
234
  "content": "A triangle with side lengths of $12$, $14$, and $20$",
235
235
  "correct": true,
236
236
  "isNoneOfTheAbove": false,
237
237
  "originalIndex": 3,
238
238
  },
239
- Object {
239
+ {
240
240
  "clue": "Congruent triangles have the same side lengths.
241
241
 
242
242
  This choice is similar to triangle $ABC$.",
@@ -251,7 +251,7 @@ describe("multi-item renderer", () => {
251
251
  "hasNoneOfTheAbove": false,
252
252
  "multipleSelect": false,
253
253
  "numCorrect": 1,
254
- "selectedChoices": Array [
254
+ "selectedChoices": [
255
255
  false,
256
256
  false,
257
257
  false,
@@ -279,24 +279,24 @@ describe("multi-item renderer", () => {
279
279
 
280
280
  // Assert
281
281
  expect(state).toMatchInlineSnapshot(`
282
- Object {
283
- "blurb": Object {},
284
- "hints": Array [
282
+ {
283
+ "blurb": {},
284
+ "hints": [
285
285
  "uno",
286
286
  "dos",
287
287
  undefined,
288
288
  ],
289
- "question": Object {
290
- "input-number 1": Object {
289
+ "question": {
290
+ "input-number 1": {
291
291
  "answerType": "number",
292
292
  "currentValue": "99",
293
293
  "rightAlign": undefined,
294
294
  "simplify": "required",
295
295
  "size": "normal",
296
296
  },
297
- "radio 1": Object {
298
- "choiceStates": Array [
299
- Object {
297
+ "radio 1": {
298
+ "choiceStates": [
299
+ {
300
300
  "correctnessShown": false,
301
301
  "crossedOut": false,
302
302
  "highlighted": false,
@@ -305,7 +305,7 @@ describe("multi-item renderer", () => {
305
305
  "readOnly": false,
306
306
  "selected": false,
307
307
  },
308
- Object {
308
+ {
309
309
  "correctnessShown": false,
310
310
  "crossedOut": false,
311
311
  "highlighted": false,
@@ -314,7 +314,7 @@ describe("multi-item renderer", () => {
314
314
  "readOnly": false,
315
315
  "selected": false,
316
316
  },
317
- Object {
317
+ {
318
318
  "correctnessShown": false,
319
319
  "crossedOut": false,
320
320
  "highlighted": false,
@@ -323,7 +323,7 @@ describe("multi-item renderer", () => {
323
323
  "readOnly": false,
324
324
  "selected": true,
325
325
  },
326
- Object {
326
+ {
327
327
  "correctnessShown": false,
328
328
  "crossedOut": false,
329
329
  "highlighted": false,
@@ -332,7 +332,7 @@ describe("multi-item renderer", () => {
332
332
  "readOnly": false,
333
333
  "selected": false,
334
334
  },
335
- Object {
335
+ {
336
336
  "correctnessShown": false,
337
337
  "crossedOut": false,
338
338
  "highlighted": false,
@@ -342,14 +342,14 @@ describe("multi-item renderer", () => {
342
342
  "selected": false,
343
343
  },
344
344
  ],
345
- "choices": Array [
346
- Object {
345
+ "choices": [
346
+ {
347
347
  "clue": "Congruent triangles have the same side lengths.",
348
348
  "content": "A triangle with side lengths of $3$, $4$, and $5$",
349
349
  "correct": false,
350
350
  "originalIndex": 0,
351
351
  },
352
- Object {
352
+ {
353
353
  "clue": "Congruent triangles have the same side lengths.
354
354
 
355
355
  This choice is similar to triangle $ABC$.",
@@ -357,21 +357,21 @@ describe("multi-item renderer", () => {
357
357
  "correct": false,
358
358
  "originalIndex": 1,
359
359
  },
360
- Object {
360
+ {
361
361
  "clue": "Congruent triangles have the same side lengths.",
362
362
  "content": "A triangle with side lengths of $10$, $12$, and $18$",
363
363
  "correct": false,
364
364
  "isNoneOfTheAbove": false,
365
365
  "originalIndex": 2,
366
366
  },
367
- Object {
367
+ {
368
368
  "clue": "Congruent triangles have the same side lengths.",
369
369
  "content": "A triangle with side lengths of $12$, $14$, and $20$",
370
370
  "correct": true,
371
371
  "isNoneOfTheAbove": false,
372
372
  "originalIndex": 3,
373
373
  },
374
- Object {
374
+ {
375
375
  "clue": "Congruent triangles have the same side lengths.
376
376
 
377
377
  This choice is similar to triangle $ABC$.",
@@ -386,7 +386,7 @@ describe("multi-item renderer", () => {
386
386
  "hasNoneOfTheAbove": false,
387
387
  "multipleSelect": false,
388
388
  "numCorrect": 1,
389
- "selectedChoices": Array [
389
+ "selectedChoices": [
390
390
  false,
391
391
  false,
392
392
  false,
@@ -594,25 +594,25 @@ describe("multi-item renderer", () => {
594
594
 
595
595
  // Assert
596
596
  expect(score).toMatchInlineSnapshot(`
597
- Object {
598
- "blurb": Object {
597
+ {
598
+ "blurb": {
599
599
  "correct": true,
600
600
  "empty": false,
601
- "guess": Array [],
601
+ "guess": [],
602
602
  "message": null,
603
- "state": Object {},
603
+ "state": {},
604
604
  },
605
- "hints": Array [
605
+ "hints": [
606
606
  null,
607
607
  null,
608
608
  null,
609
609
  ],
610
- "question": Object {
610
+ "question": {
611
611
  "correct": true,
612
612
  "empty": false,
613
- "guess": Array [
614
- Object {
615
- "choicesSelected": Array [
613
+ "guess": [
614
+ {
615
+ "choicesSelected": [
616
616
  false,
617
617
  false,
618
618
  false,
@@ -624,22 +624,22 @@ describe("multi-item renderer", () => {
624
624
  "noneOfTheAboveSelected": false,
625
625
  "numCorrect": 1,
626
626
  },
627
- Object {
627
+ {
628
628
  "currentValue": "-42",
629
629
  },
630
630
  ],
631
631
  "message": null,
632
- "state": Object {
633
- "input-number 1": Object {
632
+ "state": {
633
+ "input-number 1": {
634
634
  "answerType": "number",
635
635
  "currentValue": "-42",
636
636
  "rightAlign": undefined,
637
637
  "simplify": "required",
638
638
  "size": "normal",
639
639
  },
640
- "radio 1": Object {
641
- "choiceStates": Array [
642
- Object {
640
+ "radio 1": {
641
+ "choiceStates": [
642
+ {
643
643
  "correctnessShown": false,
644
644
  "crossedOut": false,
645
645
  "highlighted": false,
@@ -648,7 +648,7 @@ describe("multi-item renderer", () => {
648
648
  "readOnly": false,
649
649
  "selected": false,
650
650
  },
651
- Object {
651
+ {
652
652
  "correctnessShown": false,
653
653
  "crossedOut": false,
654
654
  "highlighted": false,
@@ -657,7 +657,7 @@ describe("multi-item renderer", () => {
657
657
  "readOnly": false,
658
658
  "selected": false,
659
659
  },
660
- Object {
660
+ {
661
661
  "correctnessShown": false,
662
662
  "crossedOut": false,
663
663
  "highlighted": false,
@@ -666,7 +666,7 @@ describe("multi-item renderer", () => {
666
666
  "readOnly": false,
667
667
  "selected": false,
668
668
  },
669
- Object {
669
+ {
670
670
  "correctnessShown": false,
671
671
  "crossedOut": false,
672
672
  "highlighted": false,
@@ -675,7 +675,7 @@ describe("multi-item renderer", () => {
675
675
  "readOnly": false,
676
676
  "selected": true,
677
677
  },
678
- Object {
678
+ {
679
679
  "correctnessShown": false,
680
680
  "crossedOut": false,
681
681
  "highlighted": false,
@@ -685,14 +685,14 @@ describe("multi-item renderer", () => {
685
685
  "selected": false,
686
686
  },
687
687
  ],
688
- "choices": Array [
689
- Object {
688
+ "choices": [
689
+ {
690
690
  "clue": "Congruent triangles have the same side lengths.",
691
691
  "content": "A triangle with side lengths of $3$, $4$, and $5$",
692
692
  "correct": false,
693
693
  "originalIndex": 0,
694
694
  },
695
- Object {
695
+ {
696
696
  "clue": "Congruent triangles have the same side lengths.
697
697
 
698
698
  This choice is similar to triangle $ABC$.",
@@ -700,21 +700,21 @@ describe("multi-item renderer", () => {
700
700
  "correct": false,
701
701
  "originalIndex": 1,
702
702
  },
703
- Object {
703
+ {
704
704
  "clue": "Congruent triangles have the same side lengths.",
705
705
  "content": "A triangle with side lengths of $10$, $12$, and $18$",
706
706
  "correct": false,
707
707
  "isNoneOfTheAbove": false,
708
708
  "originalIndex": 2,
709
709
  },
710
- Object {
710
+ {
711
711
  "clue": "Congruent triangles have the same side lengths.",
712
712
  "content": "A triangle with side lengths of $12$, $14$, and $20$",
713
713
  "correct": true,
714
714
  "isNoneOfTheAbove": false,
715
715
  "originalIndex": 3,
716
716
  },
717
- Object {
717
+ {
718
718
  "clue": "Congruent triangles have the same side lengths.
719
719
 
720
720
  This choice is similar to triangle $ABC$.",
@@ -729,7 +729,7 @@ describe("multi-item renderer", () => {
729
729
  "hasNoneOfTheAbove": false,
730
730
  "multipleSelect": false,
731
731
  "numCorrect": 1,
732
- "selectedChoices": Array [
732
+ "selectedChoices": [
733
733
  false,
734
734
  false,
735
735
  false,
@@ -755,19 +755,19 @@ describe("multi-item renderer", () => {
755
755
 
756
756
  // Assert
757
757
  expect(score).toMatchInlineSnapshot(`
758
- Object {
758
+ {
759
759
  "correct": true,
760
760
  "empty": false,
761
- "guess": Object {
762
- "blurb": Array [],
763
- "hints": Array [
761
+ "guess": {
762
+ "blurb": [],
763
+ "hints": [
764
764
  null,
765
765
  null,
766
766
  null,
767
767
  ],
768
- "question": Array [
769
- Object {
770
- "choicesSelected": Array [
768
+ "question": [
769
+ {
770
+ "choicesSelected": [
771
771
  false,
772
772
  false,
773
773
  false,
@@ -779,25 +779,25 @@ describe("multi-item renderer", () => {
779
779
  "noneOfTheAboveSelected": false,
780
780
  "numCorrect": 1,
781
781
  },
782
- Object {
782
+ {
783
783
  "currentValue": "-42",
784
784
  },
785
785
  ],
786
786
  },
787
787
  "message": null,
788
- "state": Array [
789
- Object {},
790
- Object {
791
- "input-number 1": Object {
788
+ "state": [
789
+ {},
790
+ {
791
+ "input-number 1": {
792
792
  "answerType": "number",
793
793
  "currentValue": "-42",
794
794
  "rightAlign": undefined,
795
795
  "simplify": "required",
796
796
  "size": "normal",
797
797
  },
798
- "radio 1": Object {
799
- "choiceStates": Array [
800
- Object {
798
+ "radio 1": {
799
+ "choiceStates": [
800
+ {
801
801
  "correctnessShown": false,
802
802
  "crossedOut": false,
803
803
  "highlighted": false,
@@ -806,7 +806,7 @@ describe("multi-item renderer", () => {
806
806
  "readOnly": false,
807
807
  "selected": false,
808
808
  },
809
- Object {
809
+ {
810
810
  "correctnessShown": false,
811
811
  "crossedOut": false,
812
812
  "highlighted": false,
@@ -815,7 +815,7 @@ describe("multi-item renderer", () => {
815
815
  "readOnly": false,
816
816
  "selected": false,
817
817
  },
818
- Object {
818
+ {
819
819
  "correctnessShown": false,
820
820
  "crossedOut": false,
821
821
  "highlighted": false,
@@ -824,7 +824,7 @@ describe("multi-item renderer", () => {
824
824
  "readOnly": false,
825
825
  "selected": false,
826
826
  },
827
- Object {
827
+ {
828
828
  "correctnessShown": false,
829
829
  "crossedOut": false,
830
830
  "highlighted": false,
@@ -833,7 +833,7 @@ describe("multi-item renderer", () => {
833
833
  "readOnly": false,
834
834
  "selected": true,
835
835
  },
836
- Object {
836
+ {
837
837
  "correctnessShown": false,
838
838
  "crossedOut": false,
839
839
  "highlighted": false,
@@ -843,14 +843,14 @@ describe("multi-item renderer", () => {
843
843
  "selected": false,
844
844
  },
845
845
  ],
846
- "choices": Array [
847
- Object {
846
+ "choices": [
847
+ {
848
848
  "clue": "Congruent triangles have the same side lengths.",
849
849
  "content": "A triangle with side lengths of $3$, $4$, and $5$",
850
850
  "correct": false,
851
851
  "originalIndex": 0,
852
852
  },
853
- Object {
853
+ {
854
854
  "clue": "Congruent triangles have the same side lengths.
855
855
 
856
856
  This choice is similar to triangle $ABC$.",
@@ -858,21 +858,21 @@ describe("multi-item renderer", () => {
858
858
  "correct": false,
859
859
  "originalIndex": 1,
860
860
  },
861
- Object {
861
+ {
862
862
  "clue": "Congruent triangles have the same side lengths.",
863
863
  "content": "A triangle with side lengths of $10$, $12$, and $18$",
864
864
  "correct": false,
865
865
  "isNoneOfTheAbove": false,
866
866
  "originalIndex": 2,
867
867
  },
868
- Object {
868
+ {
869
869
  "clue": "Congruent triangles have the same side lengths.",
870
870
  "content": "A triangle with side lengths of $12$, $14$, and $20$",
871
871
  "correct": true,
872
872
  "isNoneOfTheAbove": false,
873
873
  "originalIndex": 3,
874
874
  },
875
- Object {
875
+ {
876
876
  "clue": "Congruent triangles have the same side lengths.
877
877
 
878
878
  This choice is similar to triangle $ABC$.",
@@ -887,7 +887,7 @@ describe("multi-item renderer", () => {
887
887
  "hasNoneOfTheAbove": false,
888
888
  "multipleSelect": false,
889
889
  "numCorrect": 1,
890
- "selectedChoices": Array [
890
+ "selectedChoices": [
891
891
  false,
892
892
  false,
893
893
  false,
package/src/renderer.jsx CHANGED
@@ -487,7 +487,7 @@ class Renderer extends React.Component<Props, State> {
487
487
  // NOTE(jeremy): Further, the widgetId we were given does not even
488
488
  // look like a widget ID (ie. `widget-type \d+`). I can't figure
489
489
  // out how to trigger this line of code though.
490
- /* istanbul ignore next line */
490
+ /* c8 ignore next line */
491
491
  return {};
492
492
  }
493
493
  return {
@@ -974,7 +974,7 @@ class Renderer extends React.Component<Props, State> {
974
974
  // NOTE(jeremy): As far as I can tell, this if is _never_
975
975
  // reached. As noted above, these are always QuestionParagraphs
976
976
  // now.
977
- /* istanbul ignore if */
977
+ /* c8 ignore if */
978
978
  if (typeof nodeOut === "string" && lastWasString) {
979
979
  /**
980
980
  * $FlowIgnore[incompatible-type]
@@ -264,13 +264,13 @@
264
264
  }
265
265
 
266
266
  .perseus-radio-rationale-content .perseus-renderer > .paragraph {
267
- .text(@choiceTextSize, @choiceLineHeight, @gray68);
267
+ .text(@choiceTextSize, @choiceLineHeight, @gray17);
268
268
 
269
269
  .paragraph {
270
- .text(@choiceTextSize, @choiceLineHeight, @gray68);
270
+ .text(@choiceTextSize, @choiceLineHeight, @gray17);
271
271
 
272
272
  .katex {
273
- color: @gray68;
273
+ color: @gray17;
274
274
  }
275
275
  }
276
276
  }
@@ -384,13 +384,13 @@
384
384
  }
385
385
 
386
386
  .perseus-radio-rationale-content .perseus-renderer > .paragraph {
387
- .text(@choiceTextSize, @choiceLineHeight, @gray68);
387
+ .text(@choiceTextSize, @choiceLineHeight, @gray17);
388
388
 
389
389
  .paragraph {
390
- .text(@choiceTextSize, @choiceLineHeight, @gray68);
390
+ .text(@choiceTextSize, @choiceLineHeight, @gray17);
391
391
 
392
392
  .katex {
393
- color: @gray68;
393
+ color: @gray17;
394
394
  }
395
395
  }
396
396
  }