Skip to content

Commit

Permalink
I4523 close suggest correction modal (#4541)
Browse files Browse the repository at this point in the history
* Match suggest_correction modal to other feedback modals

* Add test that works against Blacklight 8

- I can't figure out why the test doesn't pass on BL7, but the code does work. I've tried adding various ways of waiting, but they make no difference
  • Loading branch information
maxkadel authored Nov 5, 2024
1 parent 524a98d commit 86ef90f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
25 changes: 8 additions & 17 deletions app/views/feedback/suggest_correction.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
<div data-blacklight-modal="container">
<div class="modal-header">
<h3 class="modal-title">Suggest a Correction</h3>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<div class="row">
<div id="generalFeedback" class="form-wrapper col">
<div class="form-wrapper">
<%= render partial: "catalog/suggest_correction_form",
locals: { form: @suggest_correction_form }
%>
</div>
</div>
</div>
</div>
</div>
<%= render Blacklight::System::ModalComponent.new do |component| %>
<% component.title { t('blacklight.suggest_correction.form.title') } %>
<% component.body do %>
<%= render partial: "catalog/suggest_correction_form",
locals: { form: @suggest_correction_form }
%>
<% end %>
<% end %>
25 changes: 25 additions & 0 deletions spec/system/catalog_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,31 @@
expect(title_field.value).to eq("Bible, Latin.")
end

it 'closes a modal for Suggest a Correction' do
if Orangelight.using_blacklight7?
true
else
visit "catalog/#{document_id}"
click_on('Suggest a Correction')
expect(page).to have_field('Name')
expect(page).to have_content('Please use this area to report errors or omissions')
page.find('.blacklight-modal-close').click
expect(page).not_to have_content('Please use this area to report errors or omissions')
end
end

it 'closes a modal for Report Harmful Language' do
if Orangelight.using_blacklight7?
true
else
visit "catalog/#{document_id}"
click_on('Report Harmful Language')
expect(page).to have_content('users may encounter offensive or harmful language')
page.find('.blacklight-modal-close').click
expect(page).not_to have_content('users may encounter offensive or harmful language')
end
end

it 'opens a modal for Report Harmful Language' do
visit "catalog/#{document_id}"
click_on('Report Harmful Language')
Expand Down

0 comments on commit 86ef90f

Please sign in to comment.