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 test case for "Today"-Link

Henriette Darged7b5289681a0
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index 96ffd8fb395..1b95f060436 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -64,6 +64,21 @@ describe 'date inplace editor',
start_date.expect_state_text '2016-01-01 - 2016-01-25'
end
+ it 'can set "today" as a date via the provided link' do
+ start_date.activate!
+ start_date.expect_active!
+
+ start_date.click_today
+
+ start_date.datepicker.expect_year Date.today.year
+ start_date.datepicker.expect_month Date.today.strftime("%B"), true
+ start_date.datepicker.expect_day Date.today.day
+
+ start_date.save!
+ start_date.expect_inactive!
+ start_date.expect_state_text '2016-01-01 - ' + Date.today.strftime('%Y-%m-%d')
+ end
+
it 'saves the date when clearing and then confirming' do
start_date.activate!
diff --git a/spec/support/edit_fields/date_edit_field.rb b/spec/support/edit_fields/date_edit_field.rb
index 7425eac4ef8..5382858b8e4 100644
--- a/spec/support/edit_fields/date_edit_field.rb
+++ b/spec/support/edit_fields/date_edit_field.rb
@@ -89,6 +89,12 @@ class DateEditField < EditField
end
end
+ def click_today
+ within_modal do
+ find('.form--field-extra-actions a', text: 'Today').click
+ end
+ end
+
def expect_value(value)
expect
expect(input_element.text).to eq(value)