Commit 59af66c6 by Adam

Merge pull request #10488 from edx/adam/disable-check-button-on-save-click

Adam/disable check button on save click
parents 79c2501c bc6caea6
......@@ -538,6 +538,19 @@ describe 'Problem', ->
runs ->
expect(window.SR.readElts).toHaveBeenCalled()
it 'disables check button while posting', ->
runs ->
spyOn($, 'postWithPrefix').andCallFake (url, answers, callback) -> callback(success: 'OK')
spyOn @problem, 'enableCheckButton'
@problem.save()
expect(@problem.enableCheckButton).toHaveBeenCalledWith false
waitsFor (->
return jQuery.active == 0
), "jQuery requests finished", 1000
runs ->
expect(@problem.enableCheckButton).toHaveBeenCalledWith true
describe 'refreshMath', ->
beforeEach ->
@problem = new Problem($('.xblock-student_view'))
......
......@@ -412,11 +412,13 @@ class @Problem
@save_internal()
save_internal: =>
@enableCheckButton false
Logger.log 'problem_save', @answers
$.postWithPrefix "#{@url}/problem_save", @answers, (response) =>
saveMessage = response.msg
@gentle_alert saveMessage
@updateProgress response
@enableCheckButton true
refreshMath: (event, element) =>
element = event.target unless element
......
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