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
Display estimated time correctly in wiki macro
Christophe Bliardd4f636146141
diff --git a/frontend/src/app/shared/components/fields/display/field-types/estimated-time-display-field.module.ts b/frontend/src/app/shared/components/fields/display/field-types/estimated-time-display-field.module.tsindex 8925083f494..b9b62a0a7bc 100644--- a/frontend/src/app/shared/components/fields/display/field-types/estimated-time-display-field.module.ts+++ b/frontend/src/app/shared/components/fields/display/field-types/estimated-time-display-field.module.ts@@ -94,6 +94,8 @@ export class EstimatedTimeDisplayField extends DisplayField {public renderSeparator(element:HTMLElement) {const span = document.createElement('span');span.classList.add('-separator');+ span.textContent = '·';+ span.ariaHidden = 'true';element.appendChild(span);}diff --git a/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sass b/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sassindex 0d8e8add02f..eb48c5a1a21 100644--- a/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sass+++ b/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sass@@ -38,6 +38,20 @@width: 100%text-align: center+// READ value of display fields in wiki macros++display-field+ & .split-time-field+ white-space: nowrap++ .-separator+ display: inline-block+ width: 1rem+ padding-left: 0.25rem+ padding-right: 0.25rem+ text-align: center++// READ value of edit fields.inline-edit--display-fielddisplay: inline-block@@ -87,8 +101,7 @@.-actual-value@include wp-table--actual-time-values- .-separator::before- content: "·"+ .-separatordisplay: inline-blockwidth: 1rempadding-left: 0.25remdiff --git a/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb b/spec/features/work_packages/display_fields/estimated_hours_display_spec.rbindex 9d3cd0c9c6f..f84c591f760 100644--- a/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb+++ b/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb@@ -28,9 +28,10 @@require 'spec_helper'-RSpec.describe 'Estimated hours display' do+RSpec.describe 'Estimated hours display', :js doshared_let(:project) { create(:project) }shared_let(:user) { create(:admin) }+ shared_let(:wiki_page) { create(:wiki_page, wiki: project.wiki) }shared_let(:query) docreate(:query,project:,@@ -46,6 +47,7 @@ RSpec.describe 'Estimated hours display' doendlet(:wp_table) { Pages::WorkPackagesTable.new project }+ let(:editor) { Components::WysiwygEditor.new }before doWorkPackages::UpdateAncestorsService@@ -55,50 +57,50 @@ RSpec.describe 'Estimated hours display' dologin_as(user)end- context "with both work and derived work" do- let_work_packages(<<~TABLE)- hierarchy | work |- parent | 1h |- child | 3h |- TABLE-- it 'work package index', :js do+ shared_examples 'estimated time display' do |expected_text:|+ it 'work package index' dowp_table.visit_query querywp_table.expect_work_package_listed childwp_table.expect_work_package_with_attributes(- parent, estimatedTime: "1 hΣ 4 h"+ parent, estimatedTime: expected_text)end- it 'work package details', :js do+ it 'work package details' dovisit work_package_path(parent.id)- expect(page).to have_content("Work\n1 hΣ 4 h")+ expect(page).to have_content("Work\n#{expected_text}")+ end++ it 'wiki page workPackageValue:id:estimatedTime macro' do+ visit edit_project_wiki_path(project, wiki_page.id)++ editor.set_markdown("workPackageValue:#{parent.id}:estimatedTime")+ click_on 'Save'++ expect(page).to have_css('.wiki-content', text: expected_text)endend- context "with just work" do+ context "with both work and derived work" dolet_work_packages(<<~TABLE)hierarchy | work |parent | 1h |- child | 0h |+ child | 3h |TABLE- it 'work package index', :js do- wp_table.visit_query query- wp_table.expect_work_package_listed child-- wp_table.expect_work_package_with_attributes(- parent, subject: parent.subject, estimatedTime: "1 h"- )- end+ include_examples 'estimated time display', expected_text: '1 h·Σ 4 h'+ end- it 'work package details', :js do- visit work_package_path(parent.id)+ context "with just work" do+ let_work_packages(<<~TABLE)+ hierarchy | work |+ parent | 1h |+ child | 0h |+ TABLE- expect(page).to have_content("Work\n1 h")- end+ include_examples 'estimated time display', expected_text: '1 h'endcontext "with just derived work with (parent work 0 h)" do@@ -108,20 +110,7 @@ RSpec.describe 'Estimated hours display' dochild | 3h |TABLE- it 'work package index', :js do- wp_table.visit_query query- wp_table.expect_work_package_listed child-- wp_table.expect_work_package_with_attributes(- parent, subject: parent.subject, estimatedTime: "0 hΣ 3 h"- )- end-- it 'work package details', :js do- visit work_package_path(parent.id)-- expect(page).to have_content("Work\n0 hΣ 3 h")- end+ include_examples 'estimated time display', expected_text: '0 h·Σ 3 h'endcontext "with just derived work (parent work unset)" do@@ -131,20 +120,7 @@ RSpec.describe 'Estimated hours display' dochild | 3h |TABLE- it 'work package index', :js do- wp_table.visit_query query- wp_table.expect_work_package_listed child-- wp_table.expect_work_package_with_attributes(- parent, subject: parent.subject, estimatedTime: "-Σ 3 h"- )- end-- it 'work package details', :js do- visit work_package_path(parent.id)-- expect(page).to have_content("Work\n-Σ 3 h")- end+ include_examples 'estimated time display', expected_text: '-·Σ 3 h'endcontext "with neither work nor derived work (both 0 h)" do@@ -154,20 +130,7 @@ RSpec.describe 'Estimated hours display' dochild | 0h |TABLE- it 'work package index', :js do- wp_table.visit_query query- wp_table.expect_work_package_listed child-- wp_table.expect_work_package_with_attributes(- parent, subject: parent.subject, estimatedTime: "0 h"- )- end-- it 'work package details', :js do- visit work_package_path(parent.id)-- expect(page).to have_content("Work\n0 h")- end+ include_examples 'estimated time display', expected_text: '0 h'endcontext "with neither work nor derived work (both unset)" do@@ -177,19 +140,6 @@ RSpec.describe 'Estimated hours display' dochild | |TABLE- it 'work package index', :js do- wp_table.visit_query query- wp_table.expect_work_package_listed child-- wp_table.expect_work_package_with_attributes(- parent, subject: parent.subject, estimatedTime: "-"- )- end-- it 'work package details', :js do- visit work_package_path(parent.id)-- expect(page).to have_content("Work\n-")- end+ include_examples 'estimated time display', expected_text: '-'endend