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
Do not trigger a refresh event on input field change event.
Dombi Attila8f215ae788b4
diff --git a/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.ts b/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.tsindex 890c42d7e5a..e233a3ea312 100644--- a/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.ts+++ b/frontend/src/app/shared/components/remote-field-updater/remote-field-updater.component.ts@@ -61,6 +61,14 @@ export class RemoteFieldUpdaterComponent implements OnInit {this.htmlMode = element.dataset.mode === 'html';const debouncedEvent = _.debounce((event:InputEvent) => {+ // Do not handle the change event on input fields, because they can trigger the+ // debouncedEvent after a form submission which will lead to a broken UI update.+ // This can happen if the form submission is clicked when an input field is still focused.+ const target = event.target as HTMLElement | null;+ if (event.type === 'change' && target instanceof HTMLInputElement) {+ return;+ }+// This prevents an update of the result list when// tabbing to the result list (9),// pressing enter (13)@@ -112,12 +120,12 @@ export class RemoteFieldUpdaterComponent implements OnInit {this.request(params)- .subscribe((response:any) => {+ .subscribe((response:string|object) => {if (this.htmlMode) {// Replace the given targetthis.target.innerHTML = response as string;} else {- _.each(response, (val:string, selector:string) => {+ _.each(response as object, (val:string, selector:string) => {const element = document.getElementById(selector) as HTMLElement|HTMLInputElement;if (element instanceof HTMLInputElement) {diff --git a/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rb b/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rbindex 18ed2734355..5f3bd2cd37e 100644--- a/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rb+++ b/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rb@@ -68,17 +68,24 @@ RSpec.describe "Work Package cost fields", :js dologin_as userend+ # It is necessary to use send keys, because some UI events are triggered on keyboard input.+ def fill_in_with_send_keys(field_name, with:)+ fill_in(field_name, with:)+ find_field(field_name).send_keys(:right)+ end+it "does not show read-only fields" dofull_view.visit!full_view.select_log_unit_costs_action# Set single value, should update suffixselect "A", from: "cost_entry_cost_type_id"- fill_in "cost_entry_units", with: "1"+ fill_in_with_send_keys "cost_entry_units", with: "1"+expect(page).to have_css("#cost_entry_unit_name", text: "A single")expect(page).to have_css("#cost_entry_costs", text: "1.00 EUR")- fill_in "cost_entry_units", with: "2"+ fill_in_with_send_keys "cost_entry_units", with: "2"expect(page).to have_css("#cost_entry_unit_name", text: "A plural")expect(page).to have_css("#cost_entry_costs", text: "2.00 EUR")@@ -90,8 +97,7 @@ RSpec.describe "Work Package cost fields", :js do# Override costsfind_by_id("cost_entry_costs").clickSeleniumHubWaiter.wait- fill_in "cost_entry_overridden_costs", with: "15.52"-+ fill_in_with_send_keys "cost_entry_overridden_costs", with: "15.52"click_on "Save"# Expect correct costs@@ -114,7 +120,7 @@ RSpec.describe "Work Package cost fields", :js dofull_view.visit!full_view.select_log_unit_costs_action- fill_in CostEntry.human_attribute_name(:units), with: "1,42"+ fill_in_with_send_keys CostEntry.human_attribute_name(:units), with: "1,42"expect(page).to have_css("#cost_entry_costs", text: "1,42 EUR")select "B", from: CostEntry.human_attribute_name(:cost_type)@@ -124,7 +130,7 @@ RSpec.describe "Work Package cost fields", :js do# Override costsfind_by_id("cost_entry_costs").clickSeleniumHubWaiter.wait- fill_in "cost_entry_overridden_costs", with: "1.350,25"+ fill_in_with_send_keys "cost_entry_overridden_costs", with: "1.350,25"click_on I18n.t(:button_save)@@ -146,7 +152,7 @@ RSpec.describe "Work Package cost fields", :js do# Update the costs in german localeSeleniumHubWaiter.wait- fill_in "cost_entry_overridden_costs", with: "55.000,55"+ fill_in_with_send_keys "cost_entry_overridden_costs", with: "55.000,55"click_on I18n.t(:button_save)# Add explicit wait for the updated cost value