Skip to content

Commit

Permalink
Fix form not being able to save by toggling required fields immediate…
Browse files Browse the repository at this point in the history
…ly (#5026)

The hidden fields of the twilio dropdown are causing the form to not be able to save.
This solves this by leaning on the toggle code already written.
  • Loading branch information
FeminismIsAwesome committed Jul 28, 2023
1 parent d653f98 commit ae40393
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions app/javascript/src/casa_org.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ function twilioToggle () {

function addCheckedAttr (el) {
el.attr('required', true)
el.setAttribute('aria-disabled', false)
el.setAttribute('aria-required', true)
el.attr('aria-disabled', false)
el.attr('aria-required', true)
el.removeAttr('disabled')
}

function removeCheckedAttr (el) {
el.removeAttr('required')
el.setAttribute('aria-required', false)
el.setAttribute('aria-disabled', true)
el.attr('aria-required', false)
el.attr('aria-disabled', true)
el.attr('disabled', true)
}

Expand All @@ -43,4 +43,5 @@ $('document').ready(() => {
}

($('.accordionTwilio').on('click', twilioToggle))
twilioToggle()
})
2 changes: 1 addition & 1 deletion spec/system/casa_org/edit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
)
end

it "can update show_driving_reimbursement flag" do
it "can update show_driving_reimbursement flag", js: true do
check "Show driving reimbursement"
click_on "Submit"
has_no_checked_field? "Show driving reimbursement"
Expand Down

0 comments on commit ae40393

Please sign in to comment.