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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix missing saving of NWD toggle for milestones (#11252)
Oliver Günther8ed0a3e9b69a
diff --git a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.tsindex 333e7833daf..74911b987fd 100644--- a/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts+++ b/frontend/src/app/shared/components/datepicker/single-date-modal/single-date.modal.ts@@ -232,6 +232,9 @@ export class SingleDateModalComponent extends OpModalComponent implements AfterV// Apply the changed scheduling mode if anythis.changeset.setValue('scheduleManually', this.scheduleManually);+ // Apply include NWD+ this.changeset.setValue('ignoreNonWorkingDays', this.ignoreNonWorkingDays);+// Apply the dates if they could be changedif (this.dateModalScheduling.isSchedulable) {this.changeset.setValue('date', mappedDate(this.date));diff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rbindex 5e85701705c..1901d7a8e82 100644--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb@@ -47,7 +47,8 @@ describe 'Datepicker modal logic test cases (WP #43539)',let(:work_packages_page) { Pages::FullWorkPackage.new(work_package, project) }let(:wp_table) { Pages::WorkPackagesTable.new(project) }- let(:date_field) { work_packages_page.edit_field(:combinedDate) }+ let(:date_attribute) { :combinedDate }+ let(:date_field) { work_packages_page.edit_field(date_attribute) }let(:datepicker) { date_field.datepicker }let(:work_package) { bug_wp }@@ -684,4 +685,32 @@ describe 'Datepicker modal logic test cases (WP #43539)',due_date: Date.parse('2021-02-09')endend++ context 'when setting ignore NWD to true for a milesotone' do+ let(:date_attribute) { :date }+ let(:work_package) { milestone_wp }+ let(:current_attributes) do+ {+ start_date: '2022-06-20',+ due_date: '2022-06-20',+ ignore_non_working_days: false+ }+ end++ it 'allows to persist that value (Regression #43932)' do+ datepicker.expect_milestone_date '2022-06-20'+ datepicker.expect_ignore_non_working_days false++ datepicker.ignore_non_working_days true++ datepicker.expect_ignore_non_working_days true+ datepicker.expect_milestone_date '2022-06-20'++ # Set date to sunday+ datepicker.set_milestone_date '2022-06-19'+ apply_and_expect_saved start_date: Date.parse('2022-06-19'),+ due_date: Date.parse('2022-06-19'),+ ignore_non_working_days: true+ end+ endenddiff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rbindex c979230e566..193542c7dbc 100644--- a/spec/support/components/datepicker/work_package_datepicker.rb+++ b/spec/support/components/datepicker/work_package_datepicker.rb@@ -53,6 +53,10 @@ module Componentsexpect(container).to have_field('duration', with: value, wait: 10)end+ def milestone_date_field+ container.find_field 'date'+ end+def start_date_fieldcontainer.find_field 'startDate'end@@ -61,6 +65,10 @@ module Componentscontainer.find_field 'endDate'end+ def focus_milestone_date+ milestone_date_field.click+ end+def focus_start_datestart_date_field.clickend@@ -69,6 +77,12 @@ module Componentsdue_date_field.clickend+ ##+ # Expect date (milestone type)+ def expect_milestone_date(value)+ expect(container).to have_field('date', with: value, wait: 20)+ end+### Expect start datedef expect_start_date(value)@@ -81,6 +95,14 @@ module Componentsexpect(container).to have_field('endDate', with: value, wait: 20)end+ def set_milestone_date(value)+ focus_milestone_date+ fill_in 'date', with: value, fill_options: { clear: :backspace }++ # Wait until debounce applied+ sleep 1+ end+def set_start_date(value)focus_start_datefill_in 'startDate', with: value, fill_options: { clear: :backspace }