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 for showing non-working days in Gantt chart

Henriette Dargec70793886a93
diff --git a/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts b/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts
index 8769e94c3e4..d6c707cabf4 100644
--- a/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts
+++ b/frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts
@@ -194,6 +194,7 @@ export class WorkPackageTableTimelineGrid implements AfterViewInit {
if (this.weekdaysService.isDateDisabled(day)) {
cell.classList.add('wp-timeline--non-working-day');
+ cell.dataset.qaSelector = `wp-timeline--non-working-day_${day.getDate()}-${day.getMonth() + 1}-${day.getFullYear()}`;
}
}
}
diff --git a/spec/features/work_packages/timeline/timeline_dates_spec.rb b/spec/features/work_packages/timeline/timeline_dates_spec.rb
index 1824e4a54e7..80089936f5c 100644
--- a/spec/features/work_packages/timeline/timeline_dates_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_dates_spec.rb
@@ -99,6 +99,24 @@ RSpec.describe 'Work package timeline date formatting',
expect_date_week '2021-01-04', '01'
end
end
+
+ context 'with weekdays defined' do
+ let(:current_user) { create :admin, language: 'en' }
+ let!(:week_days) { create :week_days }
+
+ it 'shows them as disabled' do
+ expect_date_week work_package.start_date.iso8601, '01'
+
+ expect(page).to have_selector('[data-qa-selector="wp-timeline--non-working-day_27-12-2020"]')
+ expect(page).to have_selector('[data-qa-selector="wp-timeline--non-working-day_2-1-2021"]')
+
+ expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_28-12-2020"]')
+ expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_29-12-2020"]')
+ expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_30-12-2020"]')
+ expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_31-12-2020"]')
+ expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_1-1-2021"]')
+ end
+ end
end
describe 'with US/CA settings',