@khanacademy/perseus 1.3.3 → 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.
- package/CHANGELOG.md +6 -0
- package/dist/es/index.js +30 -25
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +30 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/__snapshots__/perseus-markdown_test.jsx.snap +111 -111
- package/src/__tests__/item-renderer_test.jsx +9 -9
- package/src/__tests__/jipt-paragraphs_test.js +3 -3
- package/src/__tests__/renderer_test.jsx +22 -22
- package/src/__tests__/server-item-renderer_test.jsx +7 -7
- package/src/components/__tests__/sortable_test.jsx +7 -7
- package/src/multi-items/__tests__/multi-renderer_test.js +90 -90
- package/src/renderer.jsx +2 -2
- package/src/widgets/__tests__/__snapshots__/grapher_test.jsx.snap +68 -68
- package/src/widgets/__tests__/__snapshots__/interaction_test.jsx.snap +5 -5
- package/src/widgets/__tests__/__snapshots__/interactive-graph_test.jsx.snap +2 -2
- package/src/widgets/__tests__/__snapshots__/passage_test.jsx.snap +2 -2
- package/src/widgets/__tests__/categorizer_test.jsx +5 -5
- package/src/widgets/__tests__/explanation_test.js +5 -5
- package/src/widgets/__tests__/graded-group-set_test.jsx +2 -2
- package/src/widgets/__tests__/group_test.jsx +49 -49
- package/src/widgets/__tests__/numeric-input_test.jsx +5 -5
- package/src/widgets/__tests__/passage_test.jsx +1 -1
- package/src/widgets/__tests__/radio/base-radio_test.jsx +28 -1
- package/src/widgets/categorizer.jsx +1 -1
- package/src/widgets/expression.jsx +6 -6
- package/src/widgets/input-number.jsx +4 -4
- package/src/widgets/numeric-input.jsx +5 -5
- package/src/widgets/radio/base-radio.jsx +8 -3
- package/src/widgets/radio/choice-icon/library-choice-icon.jsx +2 -2
- package/src/widgets/radio/widget.jsx +2 -2
package/dist/index.js
CHANGED
|
@@ -19343,7 +19343,7 @@ class Renderer extends React__namespace.Component {
|
|
|
19343
19343
|
// look like a widget ID (ie. `widget-type \d+`). I can't figure
|
|
19344
19344
|
// out how to trigger this line of code though.
|
|
19345
19345
|
|
|
19346
|
-
/*
|
|
19346
|
+
/* c8 ignore next line */
|
|
19347
19347
|
return {};
|
|
19348
19348
|
}
|
|
19349
19349
|
|
|
@@ -19682,7 +19682,7 @@ class Renderer extends React__namespace.Component {
|
|
|
19682
19682
|
// reached. As noted above, these are always QuestionParagraphs
|
|
19683
19683
|
// now.
|
|
19684
19684
|
|
|
19685
|
-
/*
|
|
19685
|
+
/* c8 ignore if */
|
|
19686
19686
|
|
|
19687
19687
|
if (typeof nodeOut === "string" && lastWasString) {
|
|
19688
19688
|
/**
|
|
@@ -22384,12 +22384,12 @@ class Expression extends React__namespace.Component {
|
|
|
22384
22384
|
});
|
|
22385
22385
|
|
|
22386
22386
|
_defineProperty(this, "_handleFocus", () => {
|
|
22387
|
-
/*
|
|
22387
|
+
/* c8 ignore next */
|
|
22388
22388
|
this.props.onFocus([]);
|
|
22389
22389
|
});
|
|
22390
22390
|
|
|
22391
22391
|
_defineProperty(this, "_handleBlur", () => {
|
|
22392
|
-
/*
|
|
22392
|
+
/* c8 ignore next */
|
|
22393
22393
|
this.props.onBlur([]);
|
|
22394
22394
|
});
|
|
22395
22395
|
|
|
@@ -22423,12 +22423,12 @@ class Expression extends React__namespace.Component {
|
|
|
22423
22423
|
// The widget itself is an input, so we return a single empty list to
|
|
22424
22424
|
// indicate this.
|
|
22425
22425
|
|
|
22426
|
-
/*
|
|
22426
|
+
/* c8 ignore next */
|
|
22427
22427
|
return [[]];
|
|
22428
22428
|
});
|
|
22429
22429
|
|
|
22430
22430
|
_defineProperty(this, "getGrammarTypeForPath", inputPath => {
|
|
22431
|
-
/*
|
|
22431
|
+
/* c8 ignore next */
|
|
22432
22432
|
return "expression";
|
|
22433
22433
|
});
|
|
22434
22434
|
|
|
@@ -22478,7 +22478,7 @@ class Expression extends React__namespace.Component {
|
|
|
22478
22478
|
// in the function variables list for the expression.
|
|
22479
22479
|
|
|
22480
22480
|
if (!expression.parsed) {
|
|
22481
|
-
/*
|
|
22481
|
+
/* c8 ignore next */
|
|
22482
22482
|
Log.error("Unable to parse solution answer for expression", Errors.InvalidInput, {
|
|
22483
22483
|
loggedMetadata: {
|
|
22484
22484
|
rubric: JSON.stringify(rubric)
|
|
@@ -22782,7 +22782,7 @@ const keypadConfigurationForProps = widgetOptions => {
|
|
|
22782
22782
|
};
|
|
22783
22783
|
|
|
22784
22784
|
const propUpgrades$2 = {
|
|
22785
|
-
/*
|
|
22785
|
+
/* c8 ignore next */
|
|
22786
22786
|
"1": v0props => ({
|
|
22787
22787
|
times: v0props.times,
|
|
22788
22788
|
buttonSets: v0props.buttonSets,
|
|
@@ -23050,12 +23050,12 @@ class InputNumber extends React__namespace.Component {
|
|
|
23050
23050
|
// The widget itself is an input, so we return a single empty list to
|
|
23051
23051
|
// indicate this.
|
|
23052
23052
|
|
|
23053
|
-
/*
|
|
23053
|
+
/* c8 ignore next */
|
|
23054
23054
|
return [[]];
|
|
23055
23055
|
});
|
|
23056
23056
|
|
|
23057
23057
|
_defineProperty(this, "getGrammarTypeForPath", path => {
|
|
23058
|
-
/*
|
|
23058
|
+
/* c8 ignore next */
|
|
23059
23059
|
return "number";
|
|
23060
23060
|
});
|
|
23061
23061
|
|
|
@@ -23116,7 +23116,7 @@ class InputNumber extends React__namespace.Component {
|
|
|
23116
23116
|
let correct = null;
|
|
23117
23117
|
let answerBlurb = null; // SAT is deprecated and not testable
|
|
23118
23118
|
|
|
23119
|
-
/*
|
|
23119
|
+
/* c8 ignore if */
|
|
23120
23120
|
|
|
23121
23121
|
if (this.props.apiOptions.satStyling && rubric) {
|
|
23122
23122
|
const score = this.simpleValidate(rubric);
|
|
@@ -23160,7 +23160,7 @@ class InputNumber extends React__namespace.Component {
|
|
|
23160
23160
|
linterContext: this.props.linterContext
|
|
23161
23161
|
}); // SAT is deprecated, answer blurb is an SAT feature
|
|
23162
23162
|
|
|
23163
|
-
/*
|
|
23163
|
+
/* c8 ignore if */
|
|
23164
23164
|
|
|
23165
23165
|
if (answerBlurb) {
|
|
23166
23166
|
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
@@ -23321,7 +23321,7 @@ class NumericInput extends React__namespace.Component {
|
|
|
23321
23321
|
let answerBlurb;
|
|
23322
23322
|
/* Ignore this block because SAT is deprecated */
|
|
23323
23323
|
|
|
23324
|
-
/*
|
|
23324
|
+
/* c8 ignore next */
|
|
23325
23325
|
|
|
23326
23326
|
if (this.props.apiOptions.satStyling && rubric) {
|
|
23327
23327
|
const score = this.simpleValidate(rubric);
|
|
@@ -23420,17 +23420,17 @@ class NumericInput extends React__namespace.Component {
|
|
|
23420
23420
|
// The widget itself is an input, so we return a single empty list to
|
|
23421
23421
|
// indicate this.
|
|
23422
23422
|
|
|
23423
|
-
/*
|
|
23423
|
+
/* c8 ignore next */
|
|
23424
23424
|
return [[]];
|
|
23425
23425
|
});
|
|
23426
23426
|
|
|
23427
23427
|
_defineProperty(this, "getGrammarTypeForPath", inputPath => {
|
|
23428
|
-
/*
|
|
23428
|
+
/* c8 ignore next */
|
|
23429
23429
|
return "number";
|
|
23430
23430
|
});
|
|
23431
23431
|
|
|
23432
23432
|
_defineProperty(this, "setInputValue", (path, newValue, cb) => {
|
|
23433
|
-
/*
|
|
23433
|
+
/* c8 ignore next */
|
|
23434
23434
|
this.props.onChange({
|
|
23435
23435
|
currentValue: newValue
|
|
23436
23436
|
}, cb);
|
|
@@ -23639,7 +23639,7 @@ class NumericInput extends React__namespace.Component {
|
|
|
23639
23639
|
});
|
|
23640
23640
|
/* This only gets used with SAT Content */
|
|
23641
23641
|
|
|
23642
|
-
/*
|
|
23642
|
+
/* c8 ignore next if */
|
|
23643
23643
|
|
|
23644
23644
|
if (answerBlurb) {
|
|
23645
23645
|
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
@@ -26872,8 +26872,8 @@ function LibraryChoiceIcon(props) {
|
|
|
26872
26872
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
26873
26873
|
style: dynamicStyles,
|
|
26874
26874
|
"data-test-id": "choice-icon__library-choice-icon",
|
|
26875
|
-
className: aphrodite.css(styles$r.circle, showCorrectness && correct && styles$r.circleCorrect, showCorrectness && !correct && styles$r.circleIncorrect, showCorrectness && !correct && (checked || previouslyAnswered) && styles$r.circleIncorrectAnswered) // used in BaseRadio to check
|
|
26876
|
-
// radio icon
|
|
26875
|
+
className: aphrodite.css(styles$r.circle, showCorrectness && correct && styles$r.circleCorrect, showCorrectness && !correct && styles$r.circleIncorrect, showCorrectness && !correct && (checked || previouslyAnswered) && styles$r.circleIncorrectAnswered) // used in BaseRadio editMode to check
|
|
26876
|
+
// if we actually clicked on the radio icon
|
|
26877
26877
|
,
|
|
26878
26878
|
"data-is-radio-icon": true
|
|
26879
26879
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -27655,7 +27655,7 @@ function BaseRadio(props) {
|
|
|
27655
27655
|
style: {
|
|
27656
27656
|
listStyle: "none"
|
|
27657
27657
|
}
|
|
27658
|
-
}, choices.map(
|
|
27658
|
+
}, choices.map((choice, i) => {
|
|
27659
27659
|
let Element = Choice$1;
|
|
27660
27660
|
const ref = /*#__PURE__*/React__namespace.createRef();
|
|
27661
27661
|
choiceRefs.current[i] = ref;
|
|
@@ -27674,6 +27674,11 @@ function BaseRadio(props) {
|
|
|
27674
27674
|
showRationale: choice.hasRationale && (reviewMode || choice.showRationale),
|
|
27675
27675
|
pos: i,
|
|
27676
27676
|
onChange: newValues => {
|
|
27677
|
+
// editMode selection is handled in clickHandler
|
|
27678
|
+
if (editMode) {
|
|
27679
|
+
return;
|
|
27680
|
+
}
|
|
27681
|
+
|
|
27677
27682
|
updateChoice(i, newValues);
|
|
27678
27683
|
},
|
|
27679
27684
|
ref
|
|
@@ -27731,7 +27736,7 @@ function BaseRadio(props) {
|
|
|
27731
27736
|
// radio icon, then we want to trigger the
|
|
27732
27737
|
// check by flipping the choice of the icon.
|
|
27733
27738
|
if (elem.getAttribute("data-is-radio-icon")) {
|
|
27734
|
-
|
|
27739
|
+
updateChoice(i, {
|
|
27735
27740
|
checked: !choice.checked,
|
|
27736
27741
|
crossedOut: choice.crossedOut
|
|
27737
27742
|
});
|
|
@@ -27755,7 +27760,7 @@ function BaseRadio(props) {
|
|
|
27755
27760
|
onClick: clickHandler,
|
|
27756
27761
|
onTouchStart: !labelWrap ? null : captureScratchpadTouchStart$2
|
|
27757
27762
|
}, /*#__PURE__*/React__namespace.createElement(Element, elementProps));
|
|
27758
|
-
}
|
|
27763
|
+
}))); // Allow for horizontal scrolling if content is too wide, which may be
|
|
27759
27764
|
// an issue especially on phones.
|
|
27760
27765
|
// This is disabled in SAT, since it conflicts with their theming.
|
|
27761
27766
|
|
|
@@ -28102,7 +28107,7 @@ class Radio$1 extends React__namespace.Component {
|
|
|
28102
28107
|
noneOfTheAboveSelected
|
|
28103
28108
|
}; // Support legacy choiceState implementation
|
|
28104
28109
|
}
|
|
28105
|
-
/*
|
|
28110
|
+
/* c8 ignore if - props.values is deprecated */
|
|
28106
28111
|
|
|
28107
28112
|
|
|
28108
28113
|
const {
|
|
@@ -28197,7 +28202,7 @@ class Radio$1 extends React__namespace.Component {
|
|
|
28197
28202
|
} else if (this.props.values) {
|
|
28198
28203
|
// Support legacy choiceStates implementation
|
|
28199
28204
|
|
|
28200
|
-
/*
|
|
28205
|
+
/* c8 ignore next - props.values is deprecated */
|
|
28201
28206
|
choiceStates = this.props.values.map(val => ({
|
|
28202
28207
|
selected: val,
|
|
28203
28208
|
crossedOut: false,
|
|
@@ -28580,7 +28585,7 @@ _defineProperty(Categorizer, "defaultProps", {
|
|
|
28580
28585
|
|
|
28581
28586
|
const pageMargin = 16; // Stylesheets aren't directly testable
|
|
28582
28587
|
|
|
28583
|
-
/*
|
|
28588
|
+
/* c8 ignore next */
|
|
28584
28589
|
|
|
28585
28590
|
const styles$m = aphrodite.StyleSheet.create({
|
|
28586
28591
|
mobileTable: {
|