Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Replace opce-attribute-help-text: Help Texts index

Alexander Brandon Colesb368f7b26f12
diff --git a/app/views/attribute_help_texts/_tab.html.erb b/app/views/attribute_help_texts/_tab.html.erb
index dc6714ea7da..91678d12376 100644
--- a/app/views/attribute_help_texts/_tab.html.erb
+++ b/app/views/attribute_help_texts/_tab.html.erb
@@ -42,13 +42,11 @@
edit_attribute_help_text_path(attribute_help_text) %>
</td>
<td>
- <%= angular_component_tag "opce-attribute-help-text",
- inputs: {
- helpTextId: attribute_help_text.id,
- attribute: attribute_help_text.attribute_name,
- attributeScope: attribute_help_text.attribute_scope,
- additionalLabel: t(:"attribute_help_texts.show_preview")
- } %>
+ <%=
+ render OpenProject::Common::AttributeHelpTextComponent.new(help_text: attribute_help_text) do |help_text|
+ help_text.with_additional_label_content(t(:"attribute_help_texts.show_preview"))
+ end
+ %>
</td>
<td class="buttons">
<%= link_to(
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index 025a88cfa44..9a298e1ca44 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -34,7 +34,6 @@ RSpec.describe "Attribute help texts", :js do
shared_let(:user_with_permission) { create(:user, global_permissions: [:edit_attribute_help_texts]) }
let(:instance) { AttributeHelpText.last }
- let(:modal) { Components::AttributeHelpTextModal.new(instance) }
let(:editor) { Components::WysiwygEditor.new }
let(:image_fixture) { UploadedFile.load_from("spec/fixtures/files/image.png") }
let(:enterprise_token) { true }
@@ -97,16 +96,21 @@ RSpec.describe "Attribute help texts", :js do
expect(instance.help_text).to match /\/api\/v3\/attachments\/\d+\/content/
# Open help text modal
- modal.open!
- expect(modal.modal_container).to have_text "My attribute help text"
- expect(modal.modal_container).to have_css("img")
- modal.expect_edit(editable: true)
+ click_on "Preview text"
- # Expect files section to be present
- expect(modal.modal_container).to have_css(".form--fieldset-legend", text: "ATTACHMENTS")
- expect(modal.modal_container).to have_test_selector("op-files-tab--file-list-item-title")
+ expect(page).to have_modal "Status"
+ within_modal "Status" do
+ expect(page).to have_text "My attribute help text"
+ expect(page).to have_css "img"
- modal.close!
+ expect(page).to have_link "Edit"
+
+ # Expect files section to be present
+ expect(page).to have_heading "Attachments"
+ expect(page).to have_test_selector("op-files-tab--file-list-item-title")
+
+ click_on "Close"
+ end
# -> edit
SeleniumHubWaiter.wait
@@ -128,16 +132,25 @@ RSpec.describe "Attribute help texts", :js do
expect(instance.help_text).to eq "New**help**text"
# Open help text modal
- modal.open!
- expect(modal.modal_container).to have_css("strong", text: "help")
- modal.expect_edit(editable: true)
+ click_on "Preview text"
+
+ within_modal "Status" do
+ expect(page).to have_css "strong", text: "help"
+
+ expect(page).to have_link "Edit"
+
+ click_on "Close"
+ end
- modal.close!
expect(page).to have_css(".attribute-help-text--entry td", text: "Status")
# Open again and edit this time
- modal.open!
- modal.edit_button.click
+ click_on "Preview text"
+
+ within_modal "Status" do
+ click_on "Edit"
+ end
+
expect(page).to have_css("#attribute_help_text_attribute_name[disabled]")
visit attribute_help_texts_path