From 2a853bbe6aab404f3ef3629e4d2d531d84dec4b5 Mon Sep 17 00:00:00 2001 From: Patrick Perkins Date: Wed, 8 Nov 2023 17:09:28 -0500 Subject: [PATCH 1/5] specs for tools modal rendering --- spec/features/tools_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 spec/features/tools_spec.rb diff --git a/spec/features/tools_spec.rb b/spec/features/tools_spec.rb new file mode 100644 index 0000000000..cf14dc8ff4 --- /dev/null +++ b/spec/features/tools_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +RSpec.describe 'Tools' do + before { visit solr_document_path('2007020969') } + it 'displays Email modal properly' do + click_link 'Email' + expect(find('div.modal-header')).to have_text I18n.t('blacklight.email.form.title') + expect(find('div.modal-body')).to have_text I18n.t('blacklight.email.form.to') + end + + it 'displays SMS modal properly' do + click_link 'SMS' + expect(find('div.modal-header')).to have_text I18n.t('blacklight.sms.form.title') + expect(find('div.modal-body')).to have_text I18n.t('blacklight.sms.form.to') + end +end From 3579d539f20c2379e7e9bdf928252261c00a91ff Mon Sep 17 00:00:00 2001 From: Patrick Perkins Date: Wed, 8 Nov 2023 17:09:49 -0500 Subject: [PATCH 2/5] update email and sms to use new viewcomponent setters --- app/views/catalog/email.html.erb | 4 ++-- app/views/catalog/sms.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 %> From a5ab6ad7e30040a7009299bdd184a14fe3d8a42f Mon Sep 17 00:00:00 2001 From: Patrick Perkins Date: Thu, 9 Nov 2023 11:39:59 -0500 Subject: [PATCH 3/5] revise capybara spec --- spec/features/tools_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/features/tools_spec.rb b/spec/features/tools_spec.rb index cf14dc8ff4..235573b9e5 100644 --- a/spec/features/tools_spec.rb +++ b/spec/features/tools_spec.rb @@ -4,13 +4,13 @@ before { visit solr_document_path('2007020969') } it 'displays Email modal properly' do click_link 'Email' - expect(find('div.modal-header')).to have_text I18n.t('blacklight.email.form.title') - expect(find('div.modal-body')).to have_text I18n.t('blacklight.email.form.to') + expect(find('div.modal-header')).to have_text 'Email This' + expect(page).to have_selector('form#email_form') end it 'displays SMS modal properly' do click_link 'SMS' - expect(find('div.modal-header')).to have_text I18n.t('blacklight.sms.form.title') - expect(find('div.modal-body')).to have_text I18n.t('blacklight.sms.form.to') + expect(find('div.modal-header')).to have_text 'SMS This' + expect(page).to have_selector('form#sms_form') end end From a0b51399eb52c97fe65c37b9ea926226c6e3e3c3 Mon Sep 17 00:00:00 2001 From: Patrick Perkins Date: Thu, 9 Nov 2023 16:09:07 -0500 Subject: [PATCH 4/5] fix citation header rendering, update specs --- app/views/catalog/_citation.html.erb | 2 +- spec/features/tools_spec.rb | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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/spec/features/tools_spec.rb b/spec/features/tools_spec.rb index 235573b9e5..d9ddd154ba 100644 --- a/spec/features/tools_spec.rb +++ b/spec/features/tools_spec.rb @@ -2,15 +2,21 @@ RSpec.describe 'Tools' do before { visit solr_document_path('2007020969') } - it 'displays Email modal properly' do + + it 'displays Email modal with form' do click_link 'Email' expect(find('div.modal-header')).to have_text 'Email This' expect(page).to have_selector('form#email_form') end - it 'displays SMS modal properly' do + it 'displays SMS modal with form' do click_link 'SMS' expect(find('div.modal-header')).to have_text 'SMS This' expect(page).to have_selector('form#sms_form') end + + it 'displays the Cite modal with expected header' do + click_link 'Cite' + expect(find('div.modal-header')).to have_text 'Cite' + end end From 3c1a5a5e3bf3f428f1e4a4bad0c047bbe4b9aabc Mon Sep 17 00:00:00 2001 From: Patrick Perkins Date: Thu, 4 Jan 2024 12:34:39 -0500 Subject: [PATCH 5/5] remove duplicate email modal spec --- spec/features/tools_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/features/tools_spec.rb b/spec/features/tools_spec.rb index d9ddd154ba..5159ffbb4d 100644 --- a/spec/features/tools_spec.rb +++ b/spec/features/tools_spec.rb @@ -3,12 +3,6 @@ RSpec.describe 'Tools' do before { visit solr_document_path('2007020969') } - it 'displays Email modal with form' do - click_link 'Email' - expect(find('div.modal-header')).to have_text 'Email This' - expect(page).to have_selector('form#email_form') - end - it 'displays SMS modal with form' do click_link 'SMS' expect(find('div.modal-header')).to have_text 'SMS This'