Skip to content

Commit

Permalink
ensure preview alert text is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwoldatwork committed Dec 12, 2024
1 parent c849a16 commit 962c0ac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/views/admin/questions/_success_text.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@
});
});

$("#form_success_text_heading").on("keyup", function(event, b) {
$(".fba-alert.usa-alert--success h3.usa-alert__heading").text(event.target.value)
$("#form_success_text_heading").on("keyup", function(event) {
$(".fba-alert.usa-alert--success h2.usa-alert__heading").text(event.target.value)
});

$("#form_success_text").on("keyup", function(event, b) {
$("#form_success_text").on("keyup", function(event) {
$(".fba-alert.usa-alert--success .usa-alert__text").html(event.target.value)
});
})
Expand Down
10 changes: 6 additions & 4 deletions spec/features/admin/forms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -474,14 +474,16 @@
end

it 'has inline editable success text heading that can be updated and saved' do
find_field(id: 'form_success_text_heading').set('"Sucesssss Header!"')
find_field(id: 'form_success_text_heading').native.send_key :tab
fill_in('form_success_text_heading', with: 'Successful Header!', fill_options: { clear: :backspace })
find('#form_success_text_heading').native.send_key :tab
expect(find(".fba-alert.usa-alert.usa-alert--success .usa-alert__heading")).to have_content('Successful Header!')
wait_for_ajax
expect(find_field(id: 'form_success_text_heading').value).to have_content('Sucesssss Header!')
expect(find_field(id: 'form_success_text_heading').value).to have_content('Successful Header!')
expect(find(".fba-alert.usa-alert.usa-alert--success .usa-alert__heading")).to have_content('Successful Header!')

# and persists after refresh
visit questions_admin_form_path(form)
expect(find_field(id: 'form_success_text_heading').value).to have_content('Sucesssss Header!')
expect(find_field(id: 'form_success_text_heading').value).to have_content('Successful Header!')
end

it 'has inline editable success text textbox that can be updated and saved' do
Expand Down

0 comments on commit 962c0ac

Please sign in to comment.