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

Add spec

Oliver Güntherd19dbee9246f
diff --git a/spec/features/wysiwyg/mentions_spec.rb b/spec/features/wysiwyg/mentions_spec.rb
index 4905df73325..d4d435af3e7 100644
--- a/spec/features/wysiwyg/mentions_spec.rb
+++ b/spec/features/wysiwyg/mentions_spec.rb
@@ -63,13 +63,18 @@ RSpec.describe "Wysiwyg work package mentions",
project:,
roles: [group_role])
end
- let(:project) { create(:project, enabled_module_names: %w[work_package_tracking]) }
+ let!(:project) { create(:project, enabled_module_names: %w[work_package_tracking]) }
+ let!(:status) { create(:default_status, name: "Some status") }
let!(:work_package) do
- User.execute_as user do
- create(:work_package, subject: "Foobar", project:)
+ User.execute_as(user) do
+ create(:work_package, subject: "Foobar", status:, author: user, project:)
end
end
+ let!(:other_work_package) do
+ create(:work_package, subject: "Other work package", status:, author: user, project:)
+ end
+
let(:wp_page) { Pages::FullWorkPackage.new work_package, project }
let(:editor) { Components::WysiwygEditor.new }
let(:activity_tab) { Components::WorkPackages::Activities.new(work_package) }
@@ -174,4 +179,28 @@ RSpec.describe "Wysiwyg work package mentions",
expect(page).to have_css("span", text: "👍")
end
+
+ it "can autocomplete work packages with different triggers" do
+ # Test # trigger
+ activity_tab.type_comment("##{other_work_package.id}")
+ page.find(".mention-list-item", text: other_work_package.subject, wait: 10).click
+ expect(page).to have_css("a.mention", text: "##{other_work_package.id}")
+ activity_tab.submit_comment
+ activity_tab.expect_journal_notes text: "##{other_work_package.id}"
+
+ # Test ## trigger
+ activity_tab.type_comment("###{other_work_package.id}")
+ page.find(".mention-list-item", text: other_work_package.subject, wait: 10).click
+ expect(page).to have_css("a.mention", text: "###{other_work_package.id}")
+ activity_tab.submit_comment
+ activity_tab.expect_journal_notes text: "NONE ##{other_work_package.id}: #{other_work_package.subject}"
+
+ # Test ### trigger
+ activity_tab.type_comment("####{other_work_package.id}")
+ page.find(".mention-list-item", text: other_work_package.subject, wait: 10).click
+ expect(page).to have_css("a.mention", text: "####{other_work_package.id}")
+ activity_tab.submit_comment
+
+ activity_tab.expect_journal_notes text: "Some statusNONE ##{other_work_package.id}: #{other_work_package.subject}"
+ end
end