Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
Lubosky committed Aug 1, 2023
1 parent eaedce9 commit e133ca7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/form_answers.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ ready = ->
message = "Case summary submitted"

removeExistingErrorMessages(panel)
container.insertAdjacentHTML('afterbegin', buildBannerHtml(message, 'success'))
panel.insertAdjacentHTML('afterbegin', buildBannerHtml(message, 'success'))

$(this).find('input:submit').remove()

Expand Down
7 changes: 6 additions & 1 deletion app/controllers/concerns/assessment_submission_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def create
respond_to do |format|
format.json { render(json_response) }
format.html do
render_flash_message_for(resource, message: resource.errors.none? ? nil : resource.errors.full_messages.join(", "))
render_flash_message_for(resource, message: flash_message)
redirect_to [namespace_name, resource.form_answer]
end
end
Expand All @@ -34,6 +34,11 @@ def form_answer

private

def flash_message
return nil if resource.errors.none?
resource.errors.full_messages.join(", ")
end

def json_response
json = @service.as_json
resp = { json: @service.errors }
Expand Down
6 changes: 6 additions & 0 deletions spec/support/shared_contexts/appraisal_form_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ def assert_description_change(section_id, header_id)
expect(page).to have_selector("textarea", count: 1)
find("textarea").fill_in(with: text)
end

all(".form-cancel-link").each(&:click)

within parent_selector do
find(".form-edit-link").click
find(".form-save-link").click
wait_for_ajax
end
Expand All @@ -135,6 +139,8 @@ def assert_multiple_description_change(section_id, header_id, prefix)

within section_id do
fill_in("#{prefix}_verdict", with: text2)
all(".form-cancel-link").each(&:click)
all(".form-edit-link").last.click
all(".form-save-link").last.click
wait_for_ajax
end
Expand Down

0 comments on commit e133ca7

Please sign in to comment.