Skip to content

Commit

Permalink
[#4641] Update app/views/catalog/_report_harmful_language_form.html.e…
Browse files Browse the repository at this point in the history
…rb and

app/views/catalog/_suggest_correction_form.html.erb with remote:true
Test feedback form modal with the event listener addition on the blacklight-modal
Mark spec/fetaures/report_harmful_language_spec as pending because of #4655

Co-authored-by: Jane Sandberg <[email protected]>
  • Loading branch information
christinach and sandbergja committed Dec 20, 2024
1 parent a4b4898 commit d77a3ba
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/views/catalog/_report_harmful_language_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%= render :partial=>'shared/flash_msg' %>
<%= simple_form_for(
form,
remote: true,
url: contact_report_harmful_language_path,
data: { blacklight_modal: 'trigger' },
html: { class: "modal_form" }
Expand Down Expand Up @@ -35,6 +36,6 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bl-dismiss="modal">Cancel</button>
<%= f.submit "Send", class: "btn btn-primary", data: {bl_dismiss: "modal"}, id: 'submit-question' %>
<%= f.submit "Send", class: "btn btn-primary", id: 'submit-question' %>
</div>
<% end %>
3 changes: 2 additions & 1 deletion app/views/catalog/_suggest_correction_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<%= render :partial=>'shared/flash_msg' %>
<%= simple_form_for(
form,
remote: true,
url: contact_suggestion_path,
data: { blacklight_modal: 'trigger' },
html: { class: "modal_form" }
Expand All @@ -20,7 +21,7 @@
<%= f.input :feedback_desc, as: :hidden %>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bl-dismiss="modal">Cancel</button>
<%= f.submit "Send", class: "btn btn-primary", data: {bl_dismiss: "modal"}, id: 'submit-suggestion' %>
<%= f.submit "Send", class: "btn btn-primary", id: 'submit-suggestion' %>
</div>
<% end %>
</div>
1 change: 1 addition & 0 deletions spec/features/report_harmful_language_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
end

it 'gives an error when the email is invalid' do
pending 'see https://github.com/pulibrary/orangelight/issues/4655'
expect(page).to have_content 'Email is not a valid email address'
end
end
19 changes: 19 additions & 0 deletions spec/system/ask_a_question_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,23 @@
expect(page).to have_text 'Your question has been submitted'
end
end
describe 'pressing the send button' do
before do
stub_libanswers_api
stub_holding_locations
visit '/catalog/99101035463506421'
scroll_to(:bottom) # needed when js: true
click_link 'Ask a Question'
fill_in 'ask_a_question_form_name', with: 'Agatha'
fill_in 'ask_a_question_form_email', with: '[email protected]'
fill_in 'ask_a_question_form_message', with: 'Murder on the Orient Express'
end
it 'closes the modal', js: true do
expect(page).to have_text('Ask a Question')
expect(page).to have_text('Message')
click_button 'Send'
expect(current_path).to eq '/catalog/99101035463506421'
expect(page).not_to have_text('Message')
end
end
end
16 changes: 16 additions & 0 deletions spec/system/report_harmful_language_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,20 @@
expect(page).to have_text 'Thank you for reporting problematic language in the Princeton University Library catalog'
end
end
describe 'pressing the send button' do
before do
stub_libanswers_api
stub_holding_locations
visit '/catalog/99105509673506421'
scroll_to(:bottom) # needed when js: true
click_link 'Report Harmful Language'
fill_in 'report_harmful_language_form_message', with: 'Please correct the harmful content of this record'
end
it 'closes the modal', js: true do
expect(page).to have_text('You are reporting the use of harmful language in this catalog record')
click_button 'Send'
expect(current_path).to eq '/catalog/99105509673506421'
expect(page).not_to have_text('You are reporting the use of harmful language in this catalog record')
end
end
end
18 changes: 18 additions & 0 deletions spec/system/suggest_correction_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,22 @@
expect(page).not_to have_text('Please use this area to report errors or omissions')
end
end
describe 'pressing the send button' do
before do
stub_libanswers_api
stub_holding_locations
visit '/catalog/99105509673506421'
scroll_to(:bottom) # needed when js: true
click_link 'Suggest a Correction'
fill_in 'suggest_correction_form_name', with: 'Hercule Poirot'
fill_in 'suggest_correction_form_email', with: '[email protected]'
fill_in 'suggest_correction_form_message', with: 'Death on the Nile'
end
it 'closes the modal', js: true do
expect(page).to have_text('Please use this area to report errors or omissions')
click_button 'Send'
expect(current_path).to eq '/catalog/99105509673506421'
expect(page).not_to have_text('Please use this area to report errors or omissions')
end
end
end

0 comments on commit d77a3ba

Please sign in to comment.