Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def tabs
{
name: "attribute_help_text",
path: attribute_help_text_custom_field_path(@custom_field),
label: AttributeHelpText.human_plural_model_name
label: AttributeHelpText.human_attribute_name(:help_text)
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def tabs
{
name: "attribute_help_text",
path: attribute_help_text_admin_settings_project_custom_field_path(@custom_field),
label: AttributeHelpText.human_plural_model_name
label: AttributeHelpText.human_attribute_name(:help_text)
}

tabs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
require "spec_helper"

RSpec.describe "Project custom field attribute help text", :js do
include Flash::Expectations

shared_let(:admin) { create(:admin) }
shared_let(:project_custom_field_section) { create(:project_custom_field_section) }
shared_let(:project_custom_field) do
Expand All @@ -52,7 +54,7 @@
visit edit_admin_settings_project_custom_field_path(project_custom_field)

# Navigate to attribute help text tab
click_on AttributeHelpText.human_plural_model_name
click_on AttributeHelpText.human_attribute_name(:help_text)

expect(page).to have_current_path(
attribute_help_text_admin_settings_project_custom_field_path(project_custom_field)
Expand Down Expand Up @@ -176,7 +178,7 @@
visit edit_admin_settings_project_custom_field_path(project_custom_field)

# Navigate to attribute help text tab
click_on AttributeHelpText.human_plural_model_name
click_on AttributeHelpText.human_attribute_name(:help_text)

expect(page).to have_current_path(
attribute_help_text_admin_settings_project_custom_field_path(project_custom_field)
Expand All @@ -190,7 +192,7 @@
)

# Navigate back to attribute help text tab
click_on AttributeHelpText.human_plural_model_name
click_on AttributeHelpText.human_attribute_name(:help_text)

expect(page).to have_current_path(
attribute_help_text_admin_settings_project_custom_field_path(project_custom_field)
Expand All @@ -201,22 +203,26 @@
describe "help text display uniqueness" do
it "creates separate help texts for different custom fields" do
other_custom_field = create(:project_custom_field,
name: "Project Priority",
field_format: "text",
project_custom_field_section:)
name: "Project Priority",
field_format: "text",
project_custom_field_section:)

# Create help text for first custom field
visit attribute_help_text_admin_settings_project_custom_field_path(project_custom_field)
fill_in "Caption", with: "Rating help"
editor.set_markdown("Help for rating")
click_button "Save"

expect_and_dismiss_flash(message: "Successful update")

# Create help text for second custom field
visit attribute_help_text_admin_settings_project_custom_field_path(other_custom_field)
fill_in "Caption", with: "Priority help"
editor.set_markdown("Help for priority")
click_button "Save"

expect_and_dismiss_flash(message: "Successful update")

# Verify both help texts exist and are different
rating_help = AttributeHelpText::Project.find_by(
attribute_name: "custom_field_#{project_custom_field.id}"
Expand Down
Loading