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

[50961] Ensure derived values are updated on hierarchy indent/outdent

Christophe Bliard02d28acdbcea
diff --git a/spec/features/work_packages/update_ancestors_spec.rb b/spec/features/work_packages/update_ancestors_spec.rb
index f8ac7af01f7..c1a5c4f8f5a 100644
--- a/spec/features/work_packages/update_ancestors_spec.rb
+++ b/spec/features/work_packages/update_ancestors_spec.rb
@@ -102,7 +102,7 @@ RSpec.describe 'Update ancestors', :js, :with_cuprite do
context 'when adding another the child' do
it 'updates the parent work and remaining work values' do
context_menu = wp_table.open_context_menu_for(parent)
- context_menu.choose('Create new child')
+ context_menu.choose(I18n.t('js.relation_buttons.add_new_child'))
split_view_create = Pages::SplitWorkPackageCreate.new(project:)
split_view_create.set_attributes({ subject: 'child 2', estimatedTime: 1, remainingTime: 3 })
@@ -115,4 +115,24 @@ RSpec.describe 'Update ancestors', :js, :with_cuprite do
expect(parent.derived_remaining_hours).to eq(parent.remaining_hours + child.remaining_hours + new_child.remaining_hours)
end
end
+
+ context 'when outdenting and indenting hierarchy of a child' do
+ it 'updates the parent work and remaining work values' do
+ context_menu = wp_table.open_context_menu_for(child)
+ context_menu.choose(I18n.t('js.relation_buttons.hierarchy_outdent'))
+ wp_table.expect_and_dismiss_toaster message: 'Successful update'
+
+ parent.reload
+ expect(parent.derived_estimated_hours).to eq(parent.estimated_hours)
+ expect(parent.derived_remaining_hours).to eq(parent.remaining_hours)
+
+ context_menu = wp_table.open_context_menu_for(child)
+ context_menu.choose(I18n.t('js.relation_buttons.hierarchy_indent'))
+ wp_table.expect_and_dismiss_toaster message: 'Successful update'
+
+ parent.reload
+ expect(parent.derived_estimated_hours).to eq(parent.estimated_hours + child.estimated_hours)
+ expect(parent.derived_remaining_hours).to eq(parent.remaining_hours + child.remaining_hours)
+ end
+ end
end