fix: question field uses real placeholder instead of template. fixed blank question handling. TNL-10395, TNL-10411.

This commit is contained in:
Ken Clary
2023-01-27 15:52:13 -05:00
parent 84fe6605c2
commit 80f2689cc2
10 changed files with 65 additions and 32 deletions

View File

@@ -21,6 +21,10 @@ export const nonQuestionKeys = [
'@_type',
'formulaequationinput',
'numericalresponse',
'stringresponse',
'multiplechoiceresponse',
'choiceresponse',
'optionresponse',
'demandhint',
];

View File

@@ -10,6 +10,7 @@ import {
advancedProblemOlX,
multipleProblemOlX,
blankProblemOLX,
blankQuestionOLX,
} from './mockData/olxTestData';
import { ProblemTypeKeys } from '../../../data/constants/problem';
@@ -153,4 +154,10 @@ describe('Check OLXParser for question parsing', () => {
const question = olxparser.parseQuestions('numericalresponse');
expect(question).toEqual(numericInputWithFeedbackAndHintsOLXException.question);
});
test('Test OLX with no question content should have empty string for question', () => {
const olxparser = new OLXParser(blankQuestionOLX.rawOLX);
const problemType = olxparser.getProblemType();
const question = olxparser.parseQuestions(problemType);
expect(question).toBe(blankQuestionOLX.question);
});
});

View File

@@ -577,3 +577,12 @@ export const multipleProblemOlX = {
export const blankProblemOLX = {
rawOLX: '<problem></problem>',
};
export const blankQuestionOLX = {
rawOLX: `<problem>
<stringresponse type="ci">
<additional_answer />
<textline size="20"/>
</stringresponse>
</problem>`,
question: '',
};