diff --git a/src/editors/containers/ProblemEditor/data/OLXParser.js b/src/editors/containers/ProblemEditor/data/OLXParser.js index c8ab63693..76010e975 100644 --- a/src/editors/containers/ProblemEditor/data/OLXParser.js +++ b/src/editors/containers/ProblemEditor/data/OLXParser.js @@ -274,7 +274,10 @@ export class OLXParser { } parseQuestions(problemType) { - const builder = new XMLBuilder(); + const options = { + ignoreAttributes: false, + }; + const builder = new XMLBuilder(options); const problemObject = _.get(this.problem, problemType); let questionObject = {}; /* TODO: How do we uniquely identify the label and description? diff --git a/src/editors/containers/ProblemEditor/data/OLXParser.test.js b/src/editors/containers/ProblemEditor/data/OLXParser.test.js index a924a8eed..d32088f6e 100644 --- a/src/editors/containers/ProblemEditor/data/OLXParser.test.js +++ b/src/editors/containers/ProblemEditor/data/OLXParser.test.js @@ -12,6 +12,7 @@ import { multipleProblemOlX, blankProblemOLX, blankQuestionOLX, + styledQuestionOLX, } from './mockData/olxTestData'; import { ProblemTypeKeys } from '../../../data/constants/problem'; @@ -161,6 +162,12 @@ describe('Check OLXParser for question parsing', () => { const question = olxparser.parseQuestions(problemType); expect(question).toBe(blankQuestionOLX.question); }); + test('Test OLX question content with styling should parse/build with correct styling', () => { + const olxparser = new OLXParser(styledQuestionOLX.rawOLX); + const problemType = olxparser.getProblemType(); + const question = olxparser.parseQuestions(problemType); + expect(question).toBe(styledQuestionOLX.question); + }); }); describe('OLXParser for problem with solution tag', () => { diff --git a/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js b/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js index 7901e40ba..176f3ad70 100644 --- a/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js +++ b/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js @@ -613,3 +613,19 @@ export const blankQuestionOLX = { `, question: '', }; +export const styledQuestionOLX = { + rawOLX: ` +

+ + + test + + +

+ + + + +
`, + question: '

test

', +};