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
Add spec to test switch from duration -> date select -> date select
Oliver Günthere03e9dbb1f61
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.htmlindex 21e2785b06f..22375483c25 100644--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.html@@ -56,6 +56,7 @@name="startDate"data-qa-selector="op-datepicker-modal--start-date-field"class="op-datepicker-modal--date-field"+ [attr.data-qa-highlighted]="showFieldAsActive('start') || undefined"[ngClass]="{'op-datepicker-modal--date-field_current' : showFieldAsActive('start')}"[(ngModel)]="dates.start"(ngModelChange)="dateChangedManually$.next()"@@ -84,6 +85,7 @@name="endDate"data-qa-selector="op-datepicker-modal--end-date-field"class="op-datepicker-modal--date-field"+ [attr.data-qa-highlighted]=" showFieldAsActive('end') || undefined"[ngClass]="{'op-datepicker-modal--date-field_current' : showFieldAsActive('end')}"[(ngModel)]="dates.end"(ngModelChange)="dateChangedManually$.next()"@@ -112,6 +114,7 @@name="duration"data-qa-selector="op-datepicker-modal--duration-field"class="op-datepicker-modal--date-field"+ [attr.data-qa-highlighted]=" showFieldAsActive('duration') || undefined"[ngClass]="{'op-datepicker-modal--date-field_current' : showFieldAsActive('duration')}"[ngModel]="displayedDuration"(ngModelChange)="updateDuration($event)"diff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rbindex f66c6f994da..231d6020618 100644--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb@@ -76,7 +76,7 @@ describe 'Datepicker modal logic test cases (WP #43539)',date_field.expect_active!end- context 'when start_date set, update due_date (test case 1)' do+ context 'when start_date set, update duration (test case 1)' dolet(:current_attributes) do{start_date: Date.parse('2021-02-08'),@@ -454,6 +454,50 @@ describe 'Datepicker modal logic test cases (WP #43539)',datepicker.expect_start_date '2021-02-15'datepicker.expect_due_date '2021-03-02'datepicker.expect_duration 11++ apply_and_expect_saved duration: 11,+ start_date: Date.parse('2021-02-15'),+ due_date: Date.parse('2021-03-02'),+ ignore_non_working_days: false+ end+ end++ describe 'when all values set and duration highlighted, select date in datepicker' do+ let(:current_attributes) do+ {+ start_date: Date.parse('2021-02-08'),+ due_date: Date.parse('2021-02-11'),+ duration: 4+ }+ end++ it 'sets start to the selected value, keeps finish date' do+ datepicker.expect_start_date '2021-02-08'+ datepicker.expect_due_date '2021-02-11'+ datepicker.expect_duration 4++ # Focus duration+ datepicker.duration_field.click+ datepicker.expect_duration_highlighted++ # Select date in datepicker+ datepicker.select_day 5++ datepicker.expect_start_date '2021-02-05'+ datepicker.expect_due_date '2021-02-11'+ datepicker.expect_duration 5++ # Focus is on finish date+ datepicker.expect_due_highlighted+ datepicker.select_day 10++ datepicker.expect_start_date '2021-02-05'+ datepicker.expect_due_date '2021-02-10'+ datepicker.expect_duration 4++ apply_and_expect_saved duration: 4,+ start_date: Date.parse('2021-02-05'),+ due_date: Date.parse('2021-02-10')endendenddiff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rbindex f2b0e041410..d1ccb47a2c9 100644--- a/spec/support/components/datepicker/datepicker.rb+++ b/spec/support/components/datepicker/datepicker.rb@@ -66,7 +66,7 @@ module Components### Expect the selected month- def expect_month(mont)+ def expect_month(month)month = Date::MONTHNAMES.index(month) if month.is_a?(String)# Month is 0-index in selectdiff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rbindex 809b3b77137..8d9fef4102b 100644--- a/spec/support/components/datepicker/work_package_datepicker.rb+++ b/spec/support/components/datepicker/work_package_datepicker.rb@@ -89,6 +89,18 @@ module Componentsstart_date_field.clickend+ def expect_start_highlighted+ expect(container).to have_selector('[data-qa-selector="op-datepicker-modal--start-date-field"][data-qa-highlighted]')+ end++ def expect_due_highlighted+ expect(container).to have_selector('[data-qa-selector="op-datepicker-modal--end-date-field"][data-qa-highlighted]')+ end++ def expect_duration_highlighted+ expect(container).to have_selector('[data-qa-selector="op-datepicker-modal--duration-field"][data-qa-highlighted]')+ end+def expect_ignore_non_working_days(val)text = ignore_non_working_days_option(val)