diff --git a/common/lib/xmodule/xmodule/js/fixtures/problem_content_1240.html b/common/lib/xmodule/xmodule/js/fixtures/problem_content_1240.html new file mode 100644 index 0000000000..0538ae498f --- /dev/null +++ b/common/lib/xmodule/xmodule/js/fixtures/problem_content_1240.html @@ -0,0 +1,22 @@ +

Problem Header

+ +
+ +
+

${_("Problem Content")}

+ +
+ + + + + + + + + + + Explanation +
+
+
diff --git a/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee b/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee index cbc05b0302..407854d876 100644 --- a/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee +++ b/common/lib/xmodule/xmodule/js/spec/capa/display_spec.coffee @@ -78,6 +78,19 @@ describe 'Problem', -> [@problem.updateMathML, @stubbedJax, $('#input_example_1').get(0)] ] + describe 'bind_with_custom_input_id', -> + beforeEach -> + spyOn window, 'update_schematics' + MathJax.Hub.getAllJax.andReturn [@stubbedJax] + @problem = new Problem($('.xblock-student_view')) + $(@).html readFixtures('problem_content_1240.html') + + it 'bind the check button', -> + expect($('div.action input.check')).toHandleWith 'click', @problem.check_fd + + it 'bind the show button', -> + expect($('div.action button.show')).toHandleWith 'click', @problem.show + describe 'renderProgressState', -> beforeEach -> @problem = new Problem($('.xblock-student_view')) diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.coffee b/common/lib/xmodule/xmodule/js/src/capa/display.coffee index 0ff252568a..680fb90111 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/capa/display.coffee @@ -25,7 +25,7 @@ class @Problem window.update_schematics() problem_prefix = @element_id.replace(/problem_/,'') - @inputs = @$("[id^=input_#{problem_prefix}_]") + @inputs = @$("[id^='input_#{problem_prefix}_']") @$('div.action input:button').click @refreshAnswers @checkButton = @$('div.action input.check') @checkButtonCheckText = @checkButton.val()