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

Fix banner expectation text and the condition for it to be shown

Henriette Darge268e0c76dc06
diff --git a/app/components/work_packages/date_picker/dialog_content_component.rb b/app/components/work_packages/date_picker/dialog_content_component.rb
index a292e5fb286..4cf40886d3a 100644
--- a/app/components/work_packages/date_picker/dialog_content_component.rb
+++ b/app/components/work_packages/date_picker/dialog_content_component.rb
@@ -84,7 +84,9 @@ module WorkPackages
end
def show_banner?
- @schedule_manually || has_relations?
+ follows_relations.any? ||
+ children.any? ||
+ (@schedule_manually && (precedes_relations.any? || work_package.parent_id.present?))
end
def has_relations?
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index 3df939b6206..d65712cca9a 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -358,7 +358,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
it "shows a banner that the relations are ignored" do
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. Click on “Show relations” for Gantt overview.",
+ text: "Manually scheduled. Dates not affected by relations.\nClick on \"Show relations\" for Gantt overview.",
wait: 5)
# When toggling manually scheduled
@@ -368,6 +368,9 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
expect(page).not_to have_test_selector("op-modal-banner-warning")
expect(page).not_to have_test_selector("op-modal-banner-info")
+ # Toggle back to see the banner again
+ start_date.toggle_scheduling_mode
+
new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
@@ -390,7 +393,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
start_date.toggle_scheduling_mode
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. Click on “Show relations” for Gantt overview.")
+ text: "Manually scheduled. Dates not affected by relations.\nClick on \"Show relations\" for Gantt overview.")
end
end
end
@@ -420,7 +423,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
# Expect banner to switch
expect(page).to have_css(test_selector("op-modal-banner-info").to_s,
- text: "The dates are determined by child work packages. Click on “Show relations” for Gantt overview.")
+ text: "The dates are determined by child work packages.\nClick on \"Show relations\" for Gantt overview.")
new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
@@ -436,7 +439,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
it "shows a banner that the dates are are determined by the child" do
expect(page).to have_css(test_selector("op-modal-banner-info").to_s,
- text: "The dates are determined by child work packages. Click on “Show relations” for Gantt overview.")
+ text: "The dates are determined by child work packages.\nClick on \"Show relations\" for Gantt overview.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
@@ -463,7 +466,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
it "allows switching to manual scheduling to set the ignore NWD (Regression #43933)" do
expect(page).to have_css(test_selector("op-modal-banner-info").to_s,
- text: "The dates are determined by child work packages. Click on “Show relations” for Gantt overview.")
+ text: "The dates are determined by child work packages.\nClick on \"Show relations\" for Gantt overview.")
# Expect "Working days only" to be checked
datepicker.expect_ignore_non_working_days_disabled
@@ -484,7 +487,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
datepicker.expect_ignore_non_working_days false, disabled: true
expect(page).to have_css(test_selector("op-modal-banner-info").to_s,
- text: "The dates are determined by child work packages. Click on “Show relations” for Gantt overview.")
+ text: "The dates are determined by child work packages.\nClick on \"Show relations\" for Gantt overview.")
end
end
end
@@ -511,14 +514,14 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
it "shows a banner that the relations are ignored" do
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. Click on “Show relations” for Gantt overview.")
+ text: "Manually scheduled. Dates not affected by relations.\nClick on \"Show relations\" for Gantt overview.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
# Expect new banner info
expect(page).to have_css(test_selector("op-modal-banner-info").to_s,
- text: "The start date is set by a predecessor. Click on “Show relations” for Gantt overview.")
+ text: "The start date is set by a predecessor.\nClick on \"Show relations\" for Gantt overview.")
new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
@@ -534,13 +537,13 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
it "shows a banner that the start date it set by the predecessor" do
expect(page).to have_css(test_selector("op-modal-banner-info").to_s,
- text: "The start date is set by a predecessor. Click on “Show relations” for Gantt overview.")
+ text: "The start date is set by a predecessor.\nClick on \"Show relations\" for Gantt overview.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. Click on “Show relations” for Gantt overview.")
+ text: "Manually scheduled. Dates not affected by relations.\nClick on \"Show relations\" for Gantt overview.")
end
end
end
@@ -566,7 +569,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
it "shows a banner that the relations are ignored" do
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. Click on “Show relations” for Gantt overview.")
+ text: "Manually scheduled. Dates not affected by relations.\nClick on \"Show relations\" for Gantt overview.")
# When toggling manually scheduled
start_date.toggle_scheduling_mode
@@ -575,6 +578,9 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
expect(page).not_to have_test_selector("op-modal-banner-warning")
expect(page).not_to have_test_selector("op-modal-banner-info")
+ # Toggle back to see the banner again
+ start_date.toggle_scheduling_mode
+
new_window = window_opened_by { click_on "Show relations" }
switch_to_window new_window
@@ -596,7 +602,7 @@ RSpec.describe "date inplace editor", :js, :selenium, with_settings: { date_form
start_date.toggle_scheduling_mode
expect(page).to have_css(test_selector("op-modal-banner-warning").to_s,
- text: "Manually scheduled. Dates not affected by relations. Click on “Show relations” for Gantt overview.")
+ text: "Manually scheduled. Dates not affected by relations.\nClick on \"Show relations\" for Gantt overview.")
end
end
end