Fix help text in wizard with validation errors
There was an edge case where we could access the headings index without
sending the mode parameter in the URL. That meant when sending the
headings form we could send a form with the mode hidden field set to an
empty string. When that happened, the returned text was
`t("admin.budgets.help.#{i18n_namespace}.`, which returned a hash.
Using `multiple` when an empty strin is received solves the issue.
This commit is contained in:
@@ -6,7 +6,7 @@ class Admin::Budgets::HelpComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def budget_mode
|
||||
(helpers.budget_mode if helpers.respond_to?(:budget_mode)) || "multiple"
|
||||
(helpers.budget_mode if helpers.respond_to?(:budget_mode)).presence || "multiple"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -81,6 +81,11 @@ describe "Budgets wizard, headings step", :admin do
|
||||
expect(page).to have_button "Cancel"
|
||||
expect(page).not_to have_button "Add new heading"
|
||||
expect(page).not_to have_content "Continue to phases"
|
||||
|
||||
within ".budgets-help" do
|
||||
expect(page).to have_content "Headings are meant"
|
||||
expect(page).not_to have_content "{"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user