diff --git a/app/javascript/controllers/soft_validations_controller.js b/app/javascript/controllers/soft_validations_controller.js index 2c223ce1c..963dd7a76 100644 --- a/app/javascript/controllers/soft_validations_controller.js +++ b/app/javascript/controllers/soft_validations_controller.js @@ -5,13 +5,8 @@ export default class extends Controller { initialize() { let url = window.location.href + "/soft_validations" - this.fetch_retry(url, { headers: { accept: "application/json" } }, 5) - } - - fetch_retry(url, options, n) { - let self = this let div = this.overrideTarget - fetch(url, options) + fetch(url, { headers: { accept: "application/json" } }) .then(response => response.json()) .then((response) => { if(response["show"]){ @@ -27,10 +22,7 @@ export default class extends Controller { button.checked = false }) } - }) - .catch(function(error) { - if (n === 1) throw error - return self.fetch_retry(url, options, n - 1) - }) + } + ) } } diff --git a/spec/features/form/validations_spec.rb b/spec/features/form/validations_spec.rb index 8aa1edb4c..43ebcf732 100644 --- a/spec/features/form/validations_spec.rb +++ b/spec/features/form/validations_spec.rb @@ -38,6 +38,7 @@ RSpec.describe "validations" do fill_in("#{question}_2i", with: month) fill_in("#{question}_3i", with: day) end + it "does not allow out of range dates to be submitted" do fill_in_date(id, "case_log_mrcdate", 3100, 12, 2000, "property_major_repairs") click_button("Save and continue")