@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
61 lines (60 loc) • 1.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var generateAnswers = function generateAnswers(n) {
var answers = [];
for (var i = 0; i < n; i++) {
answers.push({
id: "answer-".concat(i),
position: i + 1,
itemBody: "Answer ".concat(i)
});
}
return answers;
};
var propValues = {
numAnswers: [0, 1, 4],
shuffleChoices: [true, false, 'locked'],
errorsAreShowing: [true, false],
overrideEditableForRegrading: [true, false]
};
var _default = exports["default"] = {
propValues: propValues,
getComponentProps: function getComponentProps(props) {
var answers = generateAnswers(props.numAnswers);
return {
enableRichContentEditor: false,
oneQuestionAtATime: false,
itemId: 'fakeItemId',
itemBody: 'Who was in the first cabinet of the USA?',
openImportModal: Function.prototype,
changeItemState: Function.prototype,
interactionData: {
choices: answers
},
scoringData: {
value: props.numAnswers > 1 ? [answers[1].id, answers[2].id] : []
},
properties: {
shuffleRules: {
choices: {
shuffled: !!props.shuffleChoices,
toLock: props.shuffleChoices == 'locked' ? [0, 1] : []
}
}
},
errors: {
itemBody: ['You must have an item body'],
interactionData: {
choices: [{
itemBody: ['Answer cannot be blank']
}, {
itemBody: ['Answer cannot be blank']
}]
}
}
};
}
};