UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

185 lines • 4.81 kB
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } var emptyExample = { errorsAreShowing: true, itemBody: '', scoringData: { value: { numeric: {}, variables: [], generatedSolutions: [] } } }; var invalidExample = { errorsAreShowing: true, itemBody: '`x` + `y`', scoringData: { value: { answerCount: 0, formula: 'x + y', numeric: {}, variables: [{ name: 'x', min: '1*10^3', max: '5*10^2', precision: 0 }, { name: 'y', min: '20', max: '10', precision: 2 }], generatedSolutions: [] } } }; var decimalExample = { errorsAreShowing: true, itemBody: '`x` + `y`', scoringData: { value: { answerCount: 3, formula: 'x + y', numeric: { marginType: 'absolute', margin: '0' }, variables: [{ name: 'x', min: '1', max: '10', precision: 0 }, { name: 'y', min: '-5.00', max: '5.00', precision: 2 }], generatedSolutions: [{ inputs: [{ name: 'x', value: '1' }, { name: 'y', value: '1.00' }], output: '2' }, { inputs: [{ name: 'x', value: '2' }, { name: 'y', value: '3.00' }], output: '5' }, { inputs: [{ name: 'x', value: '1' }, { name: 'y', value: '-1.00' }], output: '0' }] } } }; var scientificNotationExample = { errorsAreShowing: true, itemBody: '`x` + `y`', scoringData: { value: { answerCount: 3, answerPrecision: 1, formula: 'x + y', scientificNotation: true, numeric: {}, variables: [{ name: 'x', min: '5.0*10^-2', max: '2.5*10^-1', precision: 1 }, { name: 'y', min: '-0.01', max: '0.01', precision: 2 }], generatedSolutions: [{ inputs: [{ name: 'x', value: '1.5*10^-1' }, { name: 'y', value: '0.00' }], output: '1.5*10^-1' }, { inputs: [{ name: 'x', value: '7.5*10^-2' }, { name: 'y', value: '-0.01' }], output: '6.5*10^-2' }, { inputs: [{ name: 'x', value: '9.0*10^-2' }, { name: 'y', value: '0.01' }], output: '1.0*10^-1' }] } } }; var scenarios = [emptyExample, invalidExample, decimalExample, _objectSpread(_objectSpread({}, decimalExample), {}, { scoringData: { value: _objectSpread(_objectSpread({}, decimalExample.scoringData.value), {}, { numeric: { marginType: 'absolute', margin: '1' } }) } }), _objectSpread(_objectSpread({}, decimalExample), {}, { scoringData: { value: _objectSpread(_objectSpread({}, decimalExample.scoringData.value), {}, { numeric: { marginType: 'percent', margin: '1' } }) } }), _objectSpread(_objectSpread({}, decimalExample), {}, { overrideEditableForRegrading: true }), scientificNotationExample, _objectSpread(_objectSpread({}, scientificNotationExample), {}, { overrideEditableForRegrading: true })]; export default { propValues: { scenario: scenarios }, getComponentProps: function getComponentProps(props) { return _objectSpread({ enableRichContentEditor: false, itemId: 'fakeItemId', interactionData: {}, changeItemState: Function.prototype, notifyScreenreader: Function.prototype, openImportModal: Function.prototype }, props.scenario); }, getParameters: function getParameters() { return { delay: 10000 }; } };