@khanacademy/perseus 19.3.1 → 19.5.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/dist/index.d.ts CHANGED
@@ -67,6 +67,7 @@ export { registerAllWidgetsForTesting } from "./util/register-all-widgets-for-te
67
67
  export * as SizingUtils from "./util/sizing-utils";
68
68
  export { getAnswersFromWidgets, injectWidgets, } from "./util/extract-perseus-data";
69
69
  export { parsePerseusItem } from "./util/parse-perseus-json";
70
+ export { generateTestPerseusItem, genericPerseusItemData, } from "./util/test-utils";
70
71
  /**
71
72
  * Mixins
72
73
  */
package/dist/index.js CHANGED
@@ -41718,7 +41718,7 @@ const init = function (options) {
41718
41718
 
41719
41719
  // This file is processed by a Rollup plugin (replace) to inject the production
41720
41720
  const libName = "@khanacademy/perseus";
41721
- const libVersion = "19.3.1";
41721
+ const libVersion = "19.5.0";
41722
41722
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
41723
41723
 
41724
41724
  const apiVersion = {
@@ -44706,6 +44706,49 @@ function parsePerseusItem(json) {
44706
44706
  return JSON.parse(json);
44707
44707
  }
44708
44708
 
44709
+ const genericPerseusItemData = {
44710
+ question: {
44711
+ content: "",
44712
+ images: {},
44713
+ widgets: {}
44714
+ },
44715
+ answerArea: {
44716
+ calculator: false,
44717
+ chi2Table: false,
44718
+ periodicTable: false,
44719
+ tTable: false,
44720
+ zTable: false,
44721
+ financialCalculatorMonthlyPayment: false,
44722
+ financialCalculatorTotalAmount: false,
44723
+ financialCalculatorTimeToPayOff: false,
44724
+ periodicTableWithKey: false
44725
+ },
44726
+ itemDataVersion: {
44727
+ major: 0,
44728
+ minor: 1
44729
+ },
44730
+ hints: [],
44731
+ _multi: null,
44732
+ answer: null
44733
+ };
44734
+
44735
+ /**
44736
+ * Generate a Perseus item object for testing purposes.
44737
+ *
44738
+ * In order to better type Perseus objects used in testing, this function
44739
+ * uses a basic Perseus object and updates it with custom values as needed.
44740
+ *
44741
+ * @param {Partial<PerseusItem>} customFields
44742
+ * @returns PerseusItem
44743
+ */
44744
+ function generateTestPerseusItem() {
44745
+ let customFields = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
44746
+ return {
44747
+ ...genericPerseusItemData,
44748
+ ...customFields
44749
+ };
44750
+ }
44751
+
44709
44752
  const EditorJsonify = {
44710
44753
  serialize: function () {
44711
44754
  // Omit props that get passed to all widgets
@@ -44762,6 +44805,8 @@ exports.buildMapper = buildMapper;
44762
44805
  exports.components = components;
44763
44806
  exports.constants = constants;
44764
44807
  exports.displaySigFigs = displaySigFigs;
44808
+ exports.generateTestPerseusItem = generateTestPerseusItem;
44809
+ exports.genericPerseusItemData = genericPerseusItemData;
44765
44810
  exports.getAnswersFromWidgets = getAnswersFromWidgets;
44766
44811
  exports.globalConstants = globalConstants;
44767
44812
  exports.globalStyles = globalStyles;