Commit fee0facd by Vik Paruchuri

Add in some docs for tests, factor out class name in js

parent 71547e29
$(document).on('click', 'section.sa-wrapper input#show', ( ->
post_url=$('section.sa-wrapper input#ajax_url').attr('url')
wrapper_name='section.sa-wrapper'
$(document).on('click', "#{wrapper_name} input#show", ( ->
post_url=$("#{wrapper_name} input#ajax_url").attr('url')
final_url="#{post_url}/sa_show"
answer=$('section.sa-wrapper textarea#answer').val()
answer=$("#{wrapper_name} textarea#answer").val()
$.post final_url, {'student_answer' : answer }, (response) ->
if response.success
$('section.sa-wrapper input#show').remove()
$('section.sa-wrapper textarea#answer').remove()
$('section.sa-wrapper p#rubric').append("Your answer: #{answer}")
$('section.sa-wrapper p#rubric').append(response.rubric)
$("#{wrapper_name} input#show").remove()
$("#{wrapper_name} textarea#answer").remove()
$("#{wrapper_name} p#rubric").append("Your answer: #{answer}")
$("#{wrapper_name} p#rubric").append(response.rubric)
else
$('section.sa-wrapper input#show').remove()
$('section.sa-wrapper p#rubric').append(response.message)
$("#{wrapper_name} input#show").remove()
$("#{wrapper_name} p#rubric").append(response.message)
));
$(document).on('click', 'section.sa-wrapper input#save', ( ->
assessment=$('section.sa-wrapper #assessment').find(':selected').text()
post_url=$('section.sa-wrapper input#ajax_url').attr('url')
$(document).on('click', "#{wrapper_name} input#save", ( ->
assessment=$("#{wrapper_name} #assessment").find(':selected').text()
post_url=$("#{wrapper_name} input#ajax_url").attr('url')
final_url="#{post_url}/sa_save"
hint=$('section.sa-wrapper textarea#hint').val()
hint=$("#{wrapper_name} textarea#hint").val()
$.post final_url, {'assessment':assessment, 'hint':hint}, (response) ->
if response.success
$('section.sa-wrapper p#save_message').append(response.message)
$('section.sa-wrapper input#save').remove()
$("#{wrapper_name} p#save_message").append(response.message)
$("#{wrapper_name} input#save").remove()
));
......@@ -115,4 +115,5 @@ class RoundTripTestCase(unittest.TestCase):
self.check_export_roundtrip(DATA_DIR, "full")
def test_selfassessment_roundtrip(self):
#Test selfassessment xmodule to see if it exports correctly
self.check_export_roundtrip(DATA_DIR,"self_assessment")
......@@ -314,7 +314,8 @@ class ImportTestCase(unittest.TestCase):
def test_selfassessment_import(self):
'''
Check to see if definition_from_xml and definition_to_xml in self_assessment_module.py function.
Check to see if definition_from_xml in self_assessment_module.py
works properly. Pulls data from the self_assessment directory in the test data directory.
'''
modulestore = XMLModuleStore(DATA_DIR, course_dirs=['self_assessment'])
......@@ -322,4 +323,5 @@ class ImportTestCase(unittest.TestCase):
sa_id = "edX/sa_test/2012_Fall"
location = Location(["i4x", "edX", "sa_test", "selfassessment", "SampleQuestion"])
sa_sample = modulestore.get_instance(sa_id, location)
#10 attempts is hard coded into SampleQuestion, which is the url_name of a selfassessment xml tag
self.assertEqual(sa_sample.metadata['attempts'], '10')
\ No newline at end of file
......@@ -2,23 +2,13 @@
"course/2012_Fall": {
"graceperiod": "2 days 5 hours 59 minutes 59 seconds",
"start": "2015-07-17T12:00",
"display_name": "Toy Course",
"display_name": "Self Assessment Test",
"graded": "true"
},
"chapter/Overview": {
"display_name": "Overview"
},
"videosequence/Toy_Videos": {
"display_name": "Toy Videos",
"format": "Lecture Sequence"
"selfassessment/SampleQuestion": {
"display_name": "Sample Question",
},
"html/secret:toylab": {
"display_name": "Toy lab"
},
"video/Video_Resources": {
"display_name": "Video Resources"
},
"video/Welcome": {
"display_name": "Welcome"
}
}
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