@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/CHANGELOG.md
CHANGED
package/dist/es/index.js
CHANGED
|
@@ -19447,7 +19447,7 @@ class Renderer extends React.Component {
|
|
|
19447
19447
|
// look like a widget ID (ie. `widget-type \d+`). I can't figure
|
|
19448
19448
|
// out how to trigger this line of code though.
|
|
19449
19449
|
|
|
19450
|
-
/*
|
|
19450
|
+
/* c8 ignore next line */
|
|
19451
19451
|
return {};
|
|
19452
19452
|
}
|
|
19453
19453
|
|
|
@@ -19786,7 +19786,7 @@ class Renderer extends React.Component {
|
|
|
19786
19786
|
// reached. As noted above, these are always QuestionParagraphs
|
|
19787
19787
|
// now.
|
|
19788
19788
|
|
|
19789
|
-
/*
|
|
19789
|
+
/* c8 ignore if */
|
|
19790
19790
|
|
|
19791
19791
|
if (typeof nodeOut === "string" && lastWasString) {
|
|
19792
19792
|
/**
|
|
@@ -22484,12 +22484,12 @@ class Expression extends React.Component {
|
|
|
22484
22484
|
});
|
|
22485
22485
|
|
|
22486
22486
|
_defineProperty(this, "_handleFocus", () => {
|
|
22487
|
-
/*
|
|
22487
|
+
/* c8 ignore next */
|
|
22488
22488
|
this.props.onFocus([]);
|
|
22489
22489
|
});
|
|
22490
22490
|
|
|
22491
22491
|
_defineProperty(this, "_handleBlur", () => {
|
|
22492
|
-
/*
|
|
22492
|
+
/* c8 ignore next */
|
|
22493
22493
|
this.props.onBlur([]);
|
|
22494
22494
|
});
|
|
22495
22495
|
|
|
@@ -22523,12 +22523,12 @@ class Expression extends React.Component {
|
|
|
22523
22523
|
// The widget itself is an input, so we return a single empty list to
|
|
22524
22524
|
// indicate this.
|
|
22525
22525
|
|
|
22526
|
-
/*
|
|
22526
|
+
/* c8 ignore next */
|
|
22527
22527
|
return [[]];
|
|
22528
22528
|
});
|
|
22529
22529
|
|
|
22530
22530
|
_defineProperty(this, "getGrammarTypeForPath", inputPath => {
|
|
22531
|
-
/*
|
|
22531
|
+
/* c8 ignore next */
|
|
22532
22532
|
return "expression";
|
|
22533
22533
|
});
|
|
22534
22534
|
|
|
@@ -22578,7 +22578,7 @@ class Expression extends React.Component {
|
|
|
22578
22578
|
// in the function variables list for the expression.
|
|
22579
22579
|
|
|
22580
22580
|
if (!expression.parsed) {
|
|
22581
|
-
/*
|
|
22581
|
+
/* c8 ignore next */
|
|
22582
22582
|
Log.error("Unable to parse solution answer for expression", Errors.InvalidInput, {
|
|
22583
22583
|
loggedMetadata: {
|
|
22584
22584
|
rubric: JSON.stringify(rubric)
|
|
@@ -22884,7 +22884,7 @@ var keypadConfigurationForProps = widgetOptions => {
|
|
|
22884
22884
|
};
|
|
22885
22885
|
|
|
22886
22886
|
var propUpgrades$2 = {
|
|
22887
|
-
/*
|
|
22887
|
+
/* c8 ignore next */
|
|
22888
22888
|
"1": v0props => ({
|
|
22889
22889
|
times: v0props.times,
|
|
22890
22890
|
buttonSets: v0props.buttonSets,
|
|
@@ -23155,12 +23155,12 @@ class InputNumber extends React.Component {
|
|
|
23155
23155
|
// The widget itself is an input, so we return a single empty list to
|
|
23156
23156
|
// indicate this.
|
|
23157
23157
|
|
|
23158
|
-
/*
|
|
23158
|
+
/* c8 ignore next */
|
|
23159
23159
|
return [[]];
|
|
23160
23160
|
});
|
|
23161
23161
|
|
|
23162
23162
|
_defineProperty(this, "getGrammarTypeForPath", path => {
|
|
23163
|
-
/*
|
|
23163
|
+
/* c8 ignore next */
|
|
23164
23164
|
return "number";
|
|
23165
23165
|
});
|
|
23166
23166
|
|
|
@@ -23221,7 +23221,7 @@ class InputNumber extends React.Component {
|
|
|
23221
23221
|
var correct = null;
|
|
23222
23222
|
var answerBlurb = null; // SAT is deprecated and not testable
|
|
23223
23223
|
|
|
23224
|
-
/*
|
|
23224
|
+
/* c8 ignore if */
|
|
23225
23225
|
|
|
23226
23226
|
if (this.props.apiOptions.satStyling && rubric) {
|
|
23227
23227
|
var score = this.simpleValidate(rubric);
|
|
@@ -23265,7 +23265,7 @@ class InputNumber extends React.Component {
|
|
|
23265
23265
|
linterContext: this.props.linterContext
|
|
23266
23266
|
}); // SAT is deprecated, answer blurb is an SAT feature
|
|
23267
23267
|
|
|
23268
|
-
/*
|
|
23268
|
+
/* c8 ignore if */
|
|
23269
23269
|
|
|
23270
23270
|
if (answerBlurb) {
|
|
23271
23271
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -23426,7 +23426,7 @@ class NumericInput extends React.Component {
|
|
|
23426
23426
|
var answerBlurb;
|
|
23427
23427
|
/* Ignore this block because SAT is deprecated */
|
|
23428
23428
|
|
|
23429
|
-
/*
|
|
23429
|
+
/* c8 ignore next */
|
|
23430
23430
|
|
|
23431
23431
|
if (this.props.apiOptions.satStyling && rubric) {
|
|
23432
23432
|
var score = this.simpleValidate(rubric);
|
|
@@ -23525,17 +23525,17 @@ class NumericInput extends React.Component {
|
|
|
23525
23525
|
// The widget itself is an input, so we return a single empty list to
|
|
23526
23526
|
// indicate this.
|
|
23527
23527
|
|
|
23528
|
-
/*
|
|
23528
|
+
/* c8 ignore next */
|
|
23529
23529
|
return [[]];
|
|
23530
23530
|
});
|
|
23531
23531
|
|
|
23532
23532
|
_defineProperty(this, "getGrammarTypeForPath", inputPath => {
|
|
23533
|
-
/*
|
|
23533
|
+
/* c8 ignore next */
|
|
23534
23534
|
return "number";
|
|
23535
23535
|
});
|
|
23536
23536
|
|
|
23537
23537
|
_defineProperty(this, "setInputValue", (path, newValue, cb) => {
|
|
23538
|
-
/*
|
|
23538
|
+
/* c8 ignore next */
|
|
23539
23539
|
this.props.onChange({
|
|
23540
23540
|
currentValue: newValue
|
|
23541
23541
|
}, cb);
|
|
@@ -23744,7 +23744,7 @@ class NumericInput extends React.Component {
|
|
|
23744
23744
|
});
|
|
23745
23745
|
/* This only gets used with SAT Content */
|
|
23746
23746
|
|
|
23747
|
-
/*
|
|
23747
|
+
/* c8 ignore next if */
|
|
23748
23748
|
|
|
23749
23749
|
if (answerBlurb) {
|
|
23750
23750
|
return /*#__PURE__*/React.createElement("span", {
|
|
@@ -26976,8 +26976,8 @@ function LibraryChoiceIcon(props) {
|
|
|
26976
26976
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26977
26977
|
style: dynamicStyles,
|
|
26978
26978
|
"data-test-id": "choice-icon__library-choice-icon",
|
|
26979
|
-
className: 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
|
|
26980
|
-
// radio icon
|
|
26979
|
+
className: 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
|
|
26980
|
+
// if we actually clicked on the radio icon
|
|
26981
26981
|
,
|
|
26982
26982
|
"data-is-radio-icon": true
|
|
26983
26983
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -27763,7 +27763,7 @@ function BaseRadio(props) {
|
|
|
27763
27763
|
style: {
|
|
27764
27764
|
listStyle: "none"
|
|
27765
27765
|
}
|
|
27766
|
-
}, choices.map(
|
|
27766
|
+
}, choices.map((choice, i) => {
|
|
27767
27767
|
var Element = Choice$1;
|
|
27768
27768
|
var ref = /*#__PURE__*/React.createRef();
|
|
27769
27769
|
choiceRefs.current[i] = ref;
|
|
@@ -27782,6 +27782,11 @@ function BaseRadio(props) {
|
|
|
27782
27782
|
showRationale: choice.hasRationale && (reviewMode || choice.showRationale),
|
|
27783
27783
|
pos: i,
|
|
27784
27784
|
onChange: newValues => {
|
|
27785
|
+
// editMode selection is handled in clickHandler
|
|
27786
|
+
if (editMode) {
|
|
27787
|
+
return;
|
|
27788
|
+
}
|
|
27789
|
+
|
|
27785
27790
|
updateChoice(i, newValues);
|
|
27786
27791
|
},
|
|
27787
27792
|
ref
|
|
@@ -27839,7 +27844,7 @@ function BaseRadio(props) {
|
|
|
27839
27844
|
// radio icon, then we want to trigger the
|
|
27840
27845
|
// check by flipping the choice of the icon.
|
|
27841
27846
|
if (elem.getAttribute("data-is-radio-icon")) {
|
|
27842
|
-
|
|
27847
|
+
updateChoice(i, {
|
|
27843
27848
|
checked: !choice.checked,
|
|
27844
27849
|
crossedOut: choice.crossedOut
|
|
27845
27850
|
});
|
|
@@ -27863,7 +27868,7 @@ function BaseRadio(props) {
|
|
|
27863
27868
|
onClick: clickHandler,
|
|
27864
27869
|
onTouchStart: !labelWrap ? null : captureScratchpadTouchStart$2
|
|
27865
27870
|
}, /*#__PURE__*/React.createElement(Element, elementProps));
|
|
27866
|
-
}
|
|
27871
|
+
}))); // Allow for horizontal scrolling if content is too wide, which may be
|
|
27867
27872
|
// an issue especially on phones.
|
|
27868
27873
|
// This is disabled in SAT, since it conflicts with their theming.
|
|
27869
27874
|
|
|
@@ -28209,7 +28214,7 @@ class Radio$1 extends React.Component {
|
|
|
28209
28214
|
noneOfTheAboveSelected
|
|
28210
28215
|
}; // Support legacy choiceState implementation
|
|
28211
28216
|
}
|
|
28212
|
-
/*
|
|
28217
|
+
/* c8 ignore if - props.values is deprecated */
|
|
28213
28218
|
|
|
28214
28219
|
|
|
28215
28220
|
var {
|
|
@@ -28304,7 +28309,7 @@ class Radio$1 extends React.Component {
|
|
|
28304
28309
|
} else if (this.props.values) {
|
|
28305
28310
|
// Support legacy choiceStates implementation
|
|
28306
28311
|
|
|
28307
|
-
/*
|
|
28312
|
+
/* c8 ignore next - props.values is deprecated */
|
|
28308
28313
|
choiceStates = this.props.values.map(val => ({
|
|
28309
28314
|
selected: val,
|
|
28310
28315
|
crossedOut: false,
|
|
@@ -28687,7 +28692,7 @@ _defineProperty(Categorizer, "defaultProps", {
|
|
|
28687
28692
|
|
|
28688
28693
|
var pageMargin = 16; // Stylesheets aren't directly testable
|
|
28689
28694
|
|
|
28690
|
-
/*
|
|
28695
|
+
/* c8 ignore next */
|
|
28691
28696
|
|
|
28692
28697
|
var styles$m = StyleSheet.create({
|
|
28693
28698
|
mobileTable: {
|