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

Adapt selection specs now that there is a debounce introduced

Oliver Günther57d6cb38f26a
diff --git a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
index 06a84da4562..af3d40c5136 100644
--- a/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
+++ b/frontend/src/app/shared/components/datepicker/multi-date-modal/multi-date.modal.ts
@@ -527,6 +527,9 @@ export class MultiDateModalComponent extends OpModalComponent implements AfterVi
// Active is on start or end, the other was missing
this.deriveOtherField(activeField);
+
+ // Set the selected date on the datepicker
+ this.enforceManualChangesToDatepicker(selectedDate);
}
}
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index 842873900fc..05cd0f1e438 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -61,6 +61,10 @@ describe 'date inplace editor',
start_date.datepicker.expect_month 'January'
start_date.datepicker.select_day '25'
+ start_date.datepicker.expect_start_date '2016-01-02'
+ start_date.datepicker.expect_due_date '2016-01-25'
+ start_date.datepicker.expect_duration 24
+
start_date.save!
start_date.expect_inactive!
start_date.expect_state_text '2016-01-02 - 2016-01-25'
@@ -74,6 +78,10 @@ describe 'date inplace editor',
start_date.datepicker.expect_month 'January'
start_date.datepicker.select_day '1'
+ start_date.datepicker.expect_start_date '2016-01-01'
+ start_date.datepicker.expect_due_date '2016-01-02'
+ start_date.datepicker.expect_duration 2
+
start_date.save!
start_date.expect_inactive!
start_date.expect_state_text '2016-01-01 - 2016-01-02'
@@ -83,7 +91,13 @@ describe 'date inplace editor',
start_date.activate!
start_date.expect_active!
- start_date.click_today
+ start_date.datepicker.expect_start_date '2016-01-02'
+ start_date.datepicker.expect_year work_package.start_date.year
+ start_date.datepicker.expect_month work_package.start_date.strftime("%B")
+ start_date.datepicker.expect_day work_package.start_date.day
+
+ start_date.datepicker.set_today :start
+ start_date.datepicker.expect_start_date Time.zone.today.iso8601
start_date.datepicker.expect_year Time.zone.today.year
start_date.datepicker.expect_month Time.zone.today.strftime("%B")
@@ -110,6 +124,10 @@ describe 'date inplace editor',
start_date.datepicker.expect_month 'January'
start_date.datepicker.select_day '1'
+ start_date.datepicker.expect_start_date '2016-01-01'
+ start_date.datepicker.expect_due_date '2016-01-24'
+ start_date.datepicker.expect_duration 24
+
start_date.save!
start_date.expect_inactive!
start_date.expect_state_text '2016-01-01 - 2016-01-24'
@@ -123,9 +141,14 @@ describe 'date inplace editor',
start_date.datepicker.expect_month 'January'
start_date.datepicker.select_day '3'
+ start_date.datepicker.expect_start_date '2016-01-03'
+
# Since the focus shifts automatically, we can directly click again to modify the end date
start_date.datepicker.select_day '21'
+ start_date.datepicker.expect_due_date '2016-01-21'
+ start_date.datepicker.expect_duration 19
+
start_date.save!
start_date.expect_inactive!
start_date.expect_state_text '2016-01-03 - 2016-01-21'
@@ -169,7 +192,10 @@ describe 'date inplace editor',
start_date.activate!
start_date.expect_active!
- start_date.click_today
+ # Wait for the datepicker to be loaded
+ sleep 1
+ start_date.datepicker.set_today :start
+ start_date.datepicker.expect_start_date Time.zone.today.iso8601
start_date.datepicker.expect_year Time.zone.today.year
start_date.datepicker.expect_month Time.zone.today.strftime("%B")
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index 34306bc5d16..35f83277b16 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -94,8 +94,9 @@ module Components
##
# Expect the selected year
def expect_year(value)
- field = flatpickr_container.first('.cur-year')
- expect(field.value.to_i).to eq(value.to_i)
+ expect(flatpickr_container).to have_selector('.cur-year') do |field|
+ field.value.to_i == value.to_i
+ end
end
##
diff --git a/spec/support/edit_fields/date_edit_field.rb b/spec/support/edit_fields/date_edit_field.rb
index c81e38961e8..08fa510f66d 100644
--- a/spec/support/edit_fields/date_edit_field.rb
+++ b/spec/support/edit_fields/date_edit_field.rb
@@ -130,12 +130,6 @@ class DateEditField < EditField
end
end
- def click_today(which: :start)
- within_modal do
- find("[data-qa-selector='datepicker-#{which}-date'] .form--field-extra-actions a", text: 'Today').click
- end
- end
-
def set_value(value)
if value.is_a?(Array)
datepicker.clear!