Commit d337da74 by Mushtaq Ali

Remove pretty print from markdown xml - TNL-5768

Revert commit bf9d467f
parent 0e8dacc7
...@@ -5,7 +5,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -5,7 +5,7 @@ describe 'MarkdownEditingDescriptor', ->
@descriptor = new MarkdownEditingDescriptor($('.problem-editor')) @descriptor = new MarkdownEditingDescriptor($('.problem-editor'))
saveResult = @descriptor.save() saveResult = @descriptor.save()
expect(saveResult.metadata.markdown).toEqual('markdown') expect(saveResult.metadata.markdown).toEqual('markdown')
expect(saveResult.data).toEqual('<problem>\n <p>markdown</p>\n</problem>') expect(saveResult.data).toXMLEqual('<problem>\n <p>markdown</p>\n</problem>')
it 'clears markdown when xml editor is selected', -> it 'clears markdown when xml editor is selected', ->
loadFixtures 'problem-with-markdown.html' loadFixtures 'problem-with-markdown.html'
@descriptor = new MarkdownEditingDescriptor($('.problem-editor')) @descriptor = new MarkdownEditingDescriptor($('.problem-editor'))
...@@ -101,7 +101,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -101,7 +101,7 @@ describe 'MarkdownEditingDescriptor', ->
describe 'markdownToXml', -> describe 'markdownToXml', ->
it 'converts raw text to paragraph', -> it 'converts raw text to paragraph', ->
data = MarkdownEditingDescriptor.markdownToXml('foo') data = MarkdownEditingDescriptor.markdownToXml('foo')
expect(data).toEqual('<problem>\n <p>foo</p>\n</problem>') expect(data).toXMLEqual('<problem>\n <p>foo</p>\n</problem>')
# test default templates # test default templates
it 'converts numerical response to xml', -> it 'converts numerical response to xml', ->
data = MarkdownEditingDescriptor.markdownToXml("""A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its numerical value. data = MarkdownEditingDescriptor.markdownToXml("""A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its numerical value.
...@@ -133,7 +133,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -133,7 +133,7 @@ describe 'MarkdownEditingDescriptor', ->
If you look at your hand, you can count that you have five fingers. If you look at your hand, you can count that you have five fingers.
[Explanation] [Explanation]
""") """)
expect(data).toEqual("""<problem> expect(data).toXMLEqual("""<problem>
<p>A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its numerical value.</p> <p>A numerical response problem accepts a line of text input from the student, and evaluates the input for correctness based on its numerical value.</p>
<p>The answer is correct if it is within a specified numerical tolerance of the expected answer.</p> <p>The answer is correct if it is within a specified numerical tolerance of the expected answer.</p>
<p>Enter the numerical value of Pi:</p> <p>Enter the numerical value of Pi:</p>
...@@ -356,7 +356,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -356,7 +356,7 @@ describe 'MarkdownEditingDescriptor', ->
When the student is ready, the explanation appears. When the student is ready, the explanation appears.
[Explanation] [Explanation]
""") """)
expect(data).toEqual(""" expect(data).toXMLEqual("""
<problem> <problem>
<p>bleh</p> <p>bleh</p>
<multiplechoiceresponse> <multiplechoiceresponse>
...@@ -680,7 +680,7 @@ describe 'MarkdownEditingDescriptor', -> ...@@ -680,7 +680,7 @@ describe 'MarkdownEditingDescriptor', ->
Code should be nicely monospaced. Code should be nicely monospaced.
[/code] [/code]
""") """)
expect(data).toEqual(""" expect(data).toXMLEqual("""
<problem> <problem>
<p>Not a header</p> <p>Not a header</p>
<h3 class="hd hd-2 problem-header">A header</h3> <h3 class="hd hd-2 problem-header">A header</h3>
......
...@@ -25,7 +25,7 @@ describe 'Markdown to xml extended hint dropdown', -> ...@@ -25,7 +25,7 @@ describe 'Markdown to xml extended hint dropdown', ->
]] ]]
""") """)
expect(data).toEqual(""" expect(data).toXMLEqual("""
<problem> <problem>
<p>Translation between Dropdown and ________ is straightforward.</p> <p>Translation between Dropdown and ________ is straightforward.</p>
<optionresponse> <optionresponse>
......
/* global CodeMirror, _, XModule, PrettyPrint */ /* global CodeMirror, _, XModule */
// no-useless-escape disabled because of warnings in regexp expressions within the // no-useless-escape disabled because of warnings in regexp expressions within the
// "toXML" code. When the "useless escapes" were removed, some of the unit tests // "toXML" code. When the "useless escapes" were removed, some of the unit tests
// failed, but only in Jenkins, indicating browser-specific behavior. // failed, but only in Jenkins, indicating browser-specific behavior.
...@@ -819,8 +819,8 @@ ...@@ -819,8 +819,8 @@
} }
// make all responsetypes descendants of a single problem element // make all responsetypes descendants of a single problem element
// safe-lint: disable=javascript-concat-html // safe-lint: disable=javascript-concat-html
finalXml = '<problem>' + responseTypesXML.join('\n\n') + finalDemandHints + '</problem>'; finalXml = '<problem>\n' + responseTypesXML.join('\n\n') + finalDemandHints + '\n</problem>';
return PrettyPrint.xml(finalXml); return finalXml;
}; };
return MarkdownEditingDescriptor; return MarkdownEditingDescriptor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment