From c427b40f9bc8383d4500d2b2b5c5a6e008efadd9 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Wed, 17 Jan 2024 16:37:52 -0600 Subject: [PATCH] Use the new slot API for the modal --- app/views/catalog/_citation.html.erb | 2 +- app/views/catalog/email.html.erb | 4 ++-- app/views/catalog/sms.html.erb | 4 ++-- spec/features/citation_spec.rb | 10 ++++++++++ spec/features/sms_spec.rb | 12 ++++++++++++ 5 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 spec/features/citation_spec.rb create mode 100644 spec/features/sms_spec.rb diff --git a/app/views/catalog/_citation.html.erb b/app/views/catalog/_citation.html.erb index e5f5fbebb0..c6d862b102 100644 --- a/app/views/catalog/_citation.html.erb +++ b/app/views/catalog/_citation.html.erb @@ -1,5 +1,5 @@ <%= render Blacklight::System::ModalComponent.new do |component| %> - <% component.title { t('blacklight.tools.citation') } %> + <% component.with_title { t('blacklight.tools.citation') } %> <%= render Blacklight::Document::CitationComponent.with_collection(@documents) if @documents.present? %> <% end %> diff --git a/app/views/catalog/email.html.erb b/app/views/catalog/email.html.erb index 89e5bda5fd..496295829e 100644 --- a/app/views/catalog/email.html.erb +++ b/app/views/catalog/email.html.erb @@ -1,7 +1,7 @@ <%= render Blacklight::System::ModalComponent.new do |component| %> - <% component.title { t('blacklight.email.form.title') } %> + <% component.with_title { t('blacklight.email.form.title') } %> - <% component.body do %> + <% component.with_body do %> <%= render 'email_form' %> <% end %> <% end %> diff --git a/app/views/catalog/sms.html.erb b/app/views/catalog/sms.html.erb index 8ad9c8e96c..685ab78f2e 100644 --- a/app/views/catalog/sms.html.erb +++ b/app/views/catalog/sms.html.erb @@ -1,7 +1,7 @@ <%= render Blacklight::System::ModalComponent.new do |component| %> - <% component.title { t('blacklight.sms.form.title') } %> + <% component.with_title { t('blacklight.sms.form.title') } %> - <% component.body do %> + <% component.with_body do %> <%= render 'sms_form' %> <% end %> <% end %> diff --git a/spec/features/citation_spec.rb b/spec/features/citation_spec.rb new file mode 100644 index 0000000000..967b176e26 --- /dev/null +++ b/spec/features/citation_spec.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +RSpec.describe 'Citation functionality' do + before { visit solr_document_path('2007020969') } + + it 'displays the Cite modal with expected header' do + click_link 'Cite' + expect(find('div.modal-header')).to have_text 'Cite' + end +end diff --git a/spec/features/sms_spec.rb b/spec/features/sms_spec.rb new file mode 100644 index 0000000000..607c6eec9b --- /dev/null +++ b/spec/features/sms_spec.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +RSpec.describe 'SMS functionality' do + before { visit solr_document_path('2007020969') } + + it 'displays SMS modal with form' do + click_link 'SMS' + expect(find('div.modal-header')).to have_text 'SMS This' + fill_in 'Phone Number:', with: '555-555-5555' + select 'Verizon', from: 'Carrier' + end +end