diff --git a/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts b/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts index cd68906703..1aa31e138c 100644 --- a/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts +++ b/modules/costs/frontend/module/augment/cost-budget-subform.augment.service.ts @@ -97,7 +97,7 @@ export class CostBudgetSubformAugmentService { private buildRefreshRequest(row:JQuery, row_identifier:string) { let request:any = { element_id: row_identifier, - fixed_date: row.find('#cost_object_fixed_date').val() + fixed_date: jQuery('#cost_object_fixed_date').val() }; // Augment common values with specific values for this type diff --git a/modules/costs/spec/features/budgets/update_budget_spec.rb b/modules/costs/spec/features/budgets/update_budget_spec.rb index ea7d37186b..24826b683c 100644 --- a/modules/costs/spec/features/budgets/update_budget_spec.rb +++ b/modules/costs/spec/features/budgets/update_budget_spec.rb @@ -97,12 +97,19 @@ describe 'updating a budget', type: :feature, js: true do budget_page.visit! click_on 'Update' + budget_page.expect_planned_costs! type: :material, row: 1, expected: '150.00 EUR' + budget_page.expect_planned_costs! type: :labor, row: 1, expected: '125.00 EUR' + budget_page.edit_unit_costs! material_budget_item.id, units: 5, comment: 'updated num stimpaks' budget_page.edit_labor_costs! labor_budget_item.id, hours: 3, user_name: user.name, comment: 'updated treatment duration' + # Test for updated planned costs (Regression #31247) + budget_page.expect_planned_costs! type: :material, row: 1, expected: '250.00 EUR' + budget_page.expect_planned_costs! type: :labor, row: 1, expected: '75.00 EUR' + click_on 'Submit' expect(budget_page).to have_content('Successful update') diff --git a/modules/costs/spec/support/pages/budget_form.rb b/modules/costs/spec/support/pages/budget_form.rb index 4cce97dc23..8e41791ede 100644 --- a/modules/costs/spec/support/pages/budget_form.rb +++ b/modules/costs/spec/support/pages/budget_form.rb @@ -100,6 +100,16 @@ module Pages @labor_rows = labor_rows + 1 end + def expect_planned_costs!(type:, row:, expected:) + raise "Unknown type: #{type}, allowed: labor, material" unless %i[labor material].include? type.to_sym + + retry_block do + container = page.all("##{type}_budget_items_fieldset td.currency.budget-table--fields")[row - 1] + actual = container.text + raise "Expected planned costs #{expected}, got #{actual}" unless expected == actual + end + end + def unit_costs_at(num_row) unit_costs_container.all('tbody td.currency')[num_row - 1] end