Merge pull request #732 from xJakub/master

Fix double-submission prevention not working.
This commit is contained in:
Raimond Garcia
2015-11-27 05:57:09 -08:00
2 changed files with 13 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ App.PreventDoubleSubmission =
button.data('text', null) button.data('text', null)
initialize: -> initialize: ->
$('form').on('submit', event, -> $('form').on('submit', (event) ->
buttons = $(this).find(':button, :submit') buttons = $(this).find(':button, :submit')
App.PreventDoubleSubmission.disable_buttons(buttons) App.PreventDoubleSubmission.disable_buttons(buttons)
).on('ajax:success', -> ).on('ajax:success', ->

View File

@@ -248,6 +248,18 @@ feature 'Commenting debates' do
end end
end end
scenario 'Submit button is disabled after clicking', :js do
login_as(user)
visit debate_path(debate)
fill_in "comment-body-debate_#{debate.id}", with: 'Testing submit button!'
click_button 'Publish comment'
# The button's text should now be "..."
# This should be checked before the Ajax request is finished
expect(page).to_not have_button 'Publish comment'
end
feature "Moderators" do feature "Moderators" do
scenario "can create comment as a moderator", :js do scenario "can create comment as a moderator", :js do
moderator = create(:moderator) moderator = create(:moderator)