blacklight 8.13.0 → 9.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. checksums.yaml +4 -4
  2. data/.env +3 -3
  3. data/.github/pull_request_template.md +7 -0
  4. data/.github/workflows/ruby.yml +98 -0
  5. data/.rubocop.yml +8 -151
  6. data/.rubocop_todo.yml +53 -74
  7. data/.solr_wrapper.yml +0 -2
  8. data/README.md +30 -8
  9. data/VERSION +1 -1
  10. data/app/assets/builds/blacklight.css +448 -0
  11. data/app/assets/javascripts/blacklight/blacklight.esm.js +8 -51
  12. data/app/assets/javascripts/blacklight/blacklight.esm.js.map +1 -1
  13. data/app/assets/javascripts/blacklight/blacklight.js +8 -51
  14. data/app/assets/javascripts/blacklight/blacklight.js.map +1 -1
  15. data/app/assets/stylesheets/blacklight/_balanced_list.scss +1 -4
  16. data/app/assets/stylesheets/blacklight/_blacklight_base.scss +1 -3
  17. data/app/assets/stylesheets/blacklight/_bookmark.scss +44 -41
  18. data/app/assets/stylesheets/blacklight/_bootstrap_overrides.scss +0 -29
  19. data/app/assets/stylesheets/blacklight/_constraints.scss +15 -24
  20. data/app/assets/stylesheets/blacklight/_controls.scss +2 -18
  21. data/app/assets/stylesheets/blacklight/_facets.scss +15 -82
  22. data/app/assets/stylesheets/blacklight/_group.scss +2 -5
  23. data/app/assets/stylesheets/blacklight/_header.scss +4 -11
  24. data/app/assets/stylesheets/blacklight/_icons.scss +0 -8
  25. data/app/assets/stylesheets/blacklight/_modal.scss +9 -10
  26. data/app/assets/stylesheets/blacklight/_pagination.scss +3 -5
  27. data/app/assets/stylesheets/blacklight/_search_form.scss +0 -1
  28. data/app/assets/stylesheets/blacklight/_search_history.scss +0 -4
  29. data/app/assets/stylesheets/blacklight/_search_results.scss +1 -15
  30. data/app/assets/stylesheets/blacklight/blacklight_defaults.scss +9 -17
  31. data/app/assets/stylesheets/blacklight/build.scss +4 -0
  32. data/app/components/blacklight/advanced_search_form_component.rb +3 -3
  33. data/app/components/blacklight/constraint_component.rb +1 -1
  34. data/app/components/blacklight/constraint_layout_component.html.erb +2 -2
  35. data/app/components/blacklight/constraints_component.html.erb +2 -2
  36. data/app/components/blacklight/constraints_component.rb +3 -3
  37. data/app/components/blacklight/document/action_component.rb +3 -1
  38. data/app/components/blacklight/document/bookmark_component.html.erb +3 -3
  39. data/app/components/blacklight/document/bookmark_component.rb +2 -3
  40. data/app/components/blacklight/document/group_component.html.erb +1 -1
  41. data/app/components/blacklight/document/more_like_this_component.rb +2 -2
  42. data/app/components/blacklight/document/page_header_component.rb +3 -3
  43. data/app/components/blacklight/document/sidebar_component.rb +5 -5
  44. data/app/components/blacklight/document_component.rb +14 -20
  45. data/app/components/blacklight/document_title_component.rb +3 -2
  46. data/app/components/blacklight/facet_field_component.html.erb +5 -5
  47. data/app/components/blacklight/facet_field_list_component.rb +4 -22
  48. data/app/components/blacklight/facet_field_pagination_component.html.erb +2 -2
  49. data/app/components/blacklight/facet_item_component.rb +2 -2
  50. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  51. data/app/components/blacklight/header_component.rb +2 -2
  52. data/app/components/blacklight/metadata_field_plain_text_layout_component.rb +2 -2
  53. data/app/components/blacklight/response/facet_group_component.html.erb +3 -18
  54. data/app/components/blacklight/response/facet_group_component.rb +7 -23
  55. data/app/components/blacklight/response/facet_toggle_button_component.html.erb +16 -0
  56. data/app/components/blacklight/response/facet_toggle_button_component.rb +14 -0
  57. data/app/components/blacklight/response/pagination_component.html.erb +1 -1
  58. data/app/components/blacklight/response/pagination_component.rb +2 -1
  59. data/app/components/blacklight/response/sort_component.rb +1 -0
  60. data/app/components/blacklight/response/view_type_button_component.html.erb +1 -1
  61. data/app/components/blacklight/response/view_type_component.html.erb +1 -1
  62. data/app/components/blacklight/search/facet_suggest_input.html.erb +7 -10
  63. data/app/components/blacklight/search/facet_suggest_input.rb +0 -4
  64. data/app/components/blacklight/search/per_page_component.html.erb +1 -1
  65. data/app/components/blacklight/search/per_page_component.rb +1 -0
  66. data/app/components/blacklight/search/sidebar_component.html.erb +1 -1
  67. data/app/components/blacklight/search/sidebar_component.rb +1 -1
  68. data/app/components/blacklight/search_bar_component.html.erb +3 -3
  69. data/app/components/blacklight/search_bar_component.rb +2 -2
  70. data/app/components/blacklight/search_button_component.rb +2 -2
  71. data/app/components/blacklight/search_context/server_applied_params_component.html.erb +2 -2
  72. data/app/components/blacklight/search_context/server_applied_params_component.rb +9 -0
  73. data/app/components/blacklight/skip_link_component.html.erb +1 -1
  74. data/app/components/blacklight/skip_link_component.rb +2 -1
  75. data/app/components/blacklight/system/dropdown_component.html.erb +1 -1
  76. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  77. data/app/components/blacklight/top_navbar_component.html.erb +1 -1
  78. data/app/controllers/concerns/blacklight/bookmarks.rb +5 -5
  79. data/app/controllers/concerns/blacklight/catalog.rb +3 -2
  80. data/app/controllers/concerns/blacklight/search_context.rb +2 -14
  81. data/app/controllers/concerns/blacklight/search_history.rb +1 -1
  82. data/app/helpers/blacklight/blacklight_helper_behavior.rb +0 -6
  83. data/app/helpers/blacklight/catalog_helper_behavior.rb +0 -10
  84. data/app/helpers/blacklight/configuration_helper_behavior.rb +2 -14
  85. data/app/helpers/blacklight/document_helper_behavior.rb +0 -26
  86. data/app/helpers/blacklight/icon_helper_behavior.rb +3 -11
  87. data/app/helpers/blacklight/render_partials_helper_behavior.rb +0 -14
  88. data/app/helpers/blacklight/url_helper_behavior.rb +1 -1
  89. data/app/javascript/{blacklight → blacklight-frontend}/bookmark_toggle.js +1 -1
  90. data/app/javascript/{blacklight → blacklight-frontend}/core.js +2 -10
  91. data/app/javascript/{blacklight → blacklight-frontend}/debounce.js +1 -1
  92. data/app/javascript/blacklight-frontend/facet_suggest.js +26 -0
  93. data/app/javascript/blacklight-frontend/index.js +18 -0
  94. data/app/javascript/{blacklight → blacklight-frontend}/modal.js +2 -14
  95. data/app/javascript/{blacklight → blacklight-frontend}/search_context.js +2 -3
  96. data/app/models/blacklight/icon.rb +2 -3
  97. data/app/models/concerns/blacklight/document.rb +0 -11
  98. data/app/models/concerns/blacklight/user.rb +1 -2
  99. data/app/presenters/blacklight/json_presenter.rb +3 -1
  100. data/app/presenters/blacklight/rendering/helper_method.rb +4 -4
  101. data/app/presenters/blacklight/rendering/join.rb +2 -2
  102. data/app/presenters/blacklight/rendering/microdata.rb +0 -1
  103. data/app/services/blacklight/search_params_yaml_coder.rb +0 -2
  104. data/app/values/blacklight/types.rb +2 -2
  105. data/app/views/bookmarks/_clear_bookmarks_widget.html.erb +0 -2
  106. data/app/views/bookmarks/index.html.erb +1 -1
  107. data/app/views/catalog/_document.atom.builder +1 -1
  108. data/app/views/catalog/_document.html.erb +1 -1
  109. data/app/views/catalog/_email_form.html.erb +2 -2
  110. data/app/views/catalog/_results_pagination.html.erb +2 -5
  111. data/app/views/catalog/_search_results.html.erb +3 -3
  112. data/app/views/catalog/_search_results_header.html.erb +1 -1
  113. data/app/views/catalog/_show_main_content.html.erb +1 -1
  114. data/app/views/catalog/_sms_form.html.erb +2 -2
  115. data/app/views/catalog/_sort_and_per_page.html.erb +1 -1
  116. data/app/views/catalog/_sort_widget.html.erb +1 -0
  117. data/app/views/catalog/facet.html.erb +9 -9
  118. data/app/views/catalog/show.html.erb +2 -3
  119. data/app/views/kaminari/blacklight/_paginator.html.erb +1 -2
  120. data/app/views/layouts/blacklight/base.html.erb +3 -7
  121. data/app/views/search_history/index.html.erb +0 -2
  122. data/blacklight.gemspec +5 -5
  123. data/config/importmap.rb +1 -1
  124. data/config/locales/blacklight.ar.yml +4 -4
  125. data/config/locales/blacklight.ca.yml +124 -124
  126. data/config/locales/blacklight.de.yml +2 -2
  127. data/config/locales/blacklight.en.yml +14 -14
  128. data/config/locales/blacklight.es.yml +4 -4
  129. data/config/locales/blacklight.fr.yml +4 -4
  130. data/config/locales/blacklight.hu.yml +4 -4
  131. data/config/locales/blacklight.it.yml +3 -3
  132. data/config/locales/blacklight.nl.yml +3 -3
  133. data/config/locales/blacklight.pt-BR.yml +3 -3
  134. data/config/locales/blacklight.sq.yml +4 -4
  135. data/config/locales/blacklight.zh.yml +4 -4
  136. data/lib/blacklight/abstract_repository.rb +2 -2
  137. data/lib/blacklight/component.rb +1 -4
  138. data/lib/blacklight/configuration/context.rb +3 -3
  139. data/lib/blacklight/configuration/field.rb +10 -10
  140. data/lib/blacklight/configuration/sort_field.rb +2 -2
  141. data/lib/blacklight/configuration/view_config.rb +2 -4
  142. data/lib/blacklight/configuration.rb +4 -10
  143. data/lib/blacklight/engine.rb +0 -6
  144. data/lib/blacklight/nested_open_struct_with_hash_access.rb +1 -1
  145. data/lib/blacklight/open_struct_with_hash_access.rb +2 -2
  146. data/lib/blacklight/parameters.rb +1 -1
  147. data/lib/blacklight/search_state/filter_field.rb +4 -4
  148. data/lib/blacklight/search_state/pivot_filter_field.rb +1 -1
  149. data/lib/blacklight/solr/request.rb +2 -8
  150. data/lib/blacklight/solr/response/facets.rb +2 -2
  151. data/lib/blacklight/solr/response.rb +1 -4
  152. data/lib/generators/blacklight/assets/importmap_generator.rb +10 -51
  153. data/lib/generators/blacklight/assets/propshaft_generator.rb +1 -1
  154. data/lib/generators/blacklight/assets_generator.rb +3 -3
  155. data/lib/generators/blacklight/controller_generator.rb +3 -3
  156. data/lib/generators/blacklight/search_builder_generator.rb +1 -1
  157. data/lib/generators/blacklight/templates/.solr_wrapper.yml +0 -2
  158. data/lib/generators/blacklight/templates/solr/conf/schema.xml +178 -264
  159. data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +18 -6
  160. data/lib/generators/blacklight/user_generator.rb +9 -10
  161. data/package.json +14 -4
  162. data/rollup.config.js +1 -1
  163. data/spec/components/blacklight/document/action_component_spec.rb +2 -6
  164. data/spec/components/blacklight/document/group_component_spec.rb +1 -1
  165. data/spec/components/blacklight/document/sidebar_component_spec.rb +5 -20
  166. data/spec/components/blacklight/document_component_spec.rb +19 -24
  167. data/spec/components/blacklight/facet_component_spec.rb +2 -2
  168. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +2 -2
  169. data/spec/components/blacklight/facet_field_list_component_spec.rb +3 -3
  170. data/spec/components/blacklight/search/facet_suggest_input_spec.rb +3 -27
  171. data/spec/components/blacklight/search_bar_component_spec.rb +1 -1
  172. data/spec/controllers/blacklight/catalog_spec.rb +1 -1
  173. data/spec/controllers/catalog_controller_spec.rb +3 -3
  174. data/spec/features/advanced_search_spec.rb +12 -12
  175. data/spec/features/axe_spec.rb +6 -11
  176. data/spec/features/bookmarks_spec.rb +60 -23
  177. data/spec/features/did_you_mean_spec.rb +17 -17
  178. data/spec/features/facet_missing_spec.rb +3 -3
  179. data/spec/features/facets_spec.rb +22 -90
  180. data/spec/features/modal_spec.rb +1 -1
  181. data/spec/features/record_view_spec.rb +14 -14
  182. data/spec/features/search_context_spec.rb +8 -9
  183. data/spec/features/search_filters_spec.rb +18 -18
  184. data/spec/features/search_formats_spec.rb +2 -2
  185. data/spec/features/search_history_spec.rb +11 -11
  186. data/spec/features/search_pagination_spec.rb +9 -9
  187. data/spec/features/search_results_spec.rb +3 -3
  188. data/spec/features/search_sort_spec.rb +4 -4
  189. data/spec/features/search_spec.rb +15 -15
  190. data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +0 -9
  191. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +1 -1
  192. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +14 -14
  193. data/spec/helpers/blacklight_helper_spec.rb +0 -6
  194. data/spec/helpers/catalog_helper_spec.rb +6 -6
  195. data/spec/lib/blacklight/open_struct_with_hash_access_spec.rb +0 -7
  196. data/spec/lib/blacklight/parameters_spec.rb +1 -12
  197. data/spec/lib/blacklight/search_state/filter_field_spec.rb +0 -18
  198. data/spec/lib/blacklight/search_state/pivot_filter_field_spec.rb +1 -1
  199. data/spec/models/blacklight/solr/request_spec.rb +7 -0
  200. data/spec/models/record_mailer_spec.rb +5 -5
  201. data/spec/models/solr_document_spec.rb +1 -5
  202. data/spec/presenters/blacklight/index_presenter_spec.rb +0 -1
  203. data/spec/presenters/blacklight/rendering/pipeline_spec.rb +0 -1
  204. data/spec/presenters/blacklight/show_presenter_spec.rb +0 -1
  205. data/spec/presenters/blacklight/thumbnail_presenter_spec.rb +0 -1
  206. data/spec/services/blacklight/search_service_spec.rb +1 -1
  207. data/spec/support/presenter_test_helpers.rb +1 -1
  208. data/spec/views/catalog/_document.html.erb_spec.rb +4 -4
  209. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +3 -3
  210. data/spec/views/catalog/_sort_and_per_page.html.erb_spec.rb +5 -5
  211. data/spec/views/catalog/facet.html.erb_spec.rb +1 -9
  212. data/spec/views/catalog/index.atom.builder_spec.rb +0 -2
  213. data/spec/views/catalog/index.html.erb_spec.rb +7 -4
  214. data/spec/views/catalog/show.html.erb_spec.rb +4 -3
  215. data/tasks/blacklight.rake +8 -5
  216. metadata +34 -65
  217. data/.github/matrix.json +0 -109
  218. data/.github/workflows/build.yml +0 -16
  219. data/.github/workflows/lint.yml +0 -25
  220. data/.github/workflows/main.yml +0 -24
  221. data/.github/workflows/test.yml +0 -57
  222. data/app/assets/stylesheets/blacklight/_autocomplete.scss +0 -25
  223. data/app/assets/stylesheets/blacklight/_mixins.scss +0 -20
  224. data/app/components/blacklight/icons/legacy_icon_component.rb +0 -30
  225. data/app/javascript/blacklight/facet_suggest.js +0 -48
  226. data/app/javascript/blacklight/index.js +0 -18
  227. data/app/views/catalog/_constraints.html.erb +0 -1
  228. data/app/views/catalog/_facets.html.erb +0 -5
  229. data/app/views/catalog/_search_form.html.erb +0 -7
  230. data/app/views/catalog/_search_header.html.erb +0 -1
  231. data/app/views/catalog/_show_sidebar.html.erb +0 -3
  232. data/app/views/catalog/_show_tools.html.erb +0 -2
  233. data/app/views/catalog/_start_over.html.erb +0 -1
  234. data/app/views/shared/_header_navbar.html.erb +0 -1
  235. data/lib/generators/blacklight/assets/sprockets_generator.rb +0 -68
  236. data/spec/components/blacklight/system/dropdown_component_spec.rb +0 -26
  237. data/spec/views/catalog/_search_header.erb_spec.rb +0 -14
  238. data/spec/views/catalog/_show_sidebar.erb_spec.rb +0 -24
  239. data/spec/views/catalog/_show_tools.html.erb_spec.rb +0 -37
  240. /data/app/javascript/{blacklight → blacklight-frontend}/button_focus.js +0 -0
  241. /data/app/javascript/{blacklight → blacklight-frontend}/checkbox_submit.js +0 -0
  242. /data/app/javascript/{blacklight → blacklight-frontend}/modalForm.js +0 -0
@@ -5,8 +5,8 @@ RSpec.describe "Search History Page" do
5
5
  it "has a link to the history page" do
6
6
  visit root_path
7
7
  click_on 'History'
8
- expect(page).to have_text 'Search History'
9
- expect(page).to have_text 'You have no search history'
8
+ expect(page).to have_content 'Search History'
9
+ expect(page).to have_content 'You have no search history'
10
10
  end
11
11
  end
12
12
 
@@ -19,15 +19,15 @@ RSpec.describe "Search History Page" do
19
19
  end
20
20
 
21
21
  it "shows searches" do
22
- expect(page).to have_text 'Your recent searches'
23
- expect(page).to have_text 'book'
24
- expect(page).to have_no_text 'dang'
22
+ expect(page).to have_content 'Your recent searches'
23
+ expect(page).to have_content 'book'
24
+ expect(page).to have_no_content 'dang'
25
25
  visit root_path
26
26
  fill_in "q", with: 'dang'
27
27
  click_on 'search'
28
28
  click_on 'History'
29
- expect(page).to have_text 'book'
30
- expect(page).to have_text 'dang'
29
+ expect(page).to have_content 'book'
30
+ expect(page).to have_content 'dang'
31
31
  end
32
32
  end
33
33
 
@@ -43,10 +43,10 @@ RSpec.describe "Search History Page" do
43
43
 
44
44
  it "is able to clear the history" do
45
45
  click_on "Clear Search History"
46
- expect(page).to have_text 'Cleared your search history.'
47
- expect(page).to have_text 'You have no search history'
48
- expect(page).to have_no_text 'book'
49
- expect(page).to have_no_text 'dang'
46
+ expect(page).to have_content 'Cleared your search history.'
47
+ expect(page).to have_content 'You have no search history'
48
+ expect(page).to have_no_content 'book'
49
+ expect(page).to have_no_content 'dang'
50
50
  end
51
51
  end
52
52
  end
@@ -6,7 +6,7 @@ RSpec.describe "Search Pagination" do
6
6
  fill_in "q", with: ''
7
7
  click_on 'search'
8
8
  within ("#sortAndPerPage") do
9
- expect(page).to have_text "1 - 10 of "
9
+ expect(page).to have_content "1 - 10 of "
10
10
  within '#per_page-dropdown' do
11
11
  expect(page).to have_link('10')
12
12
  expect(page).to have_link('20')
@@ -18,11 +18,11 @@ RSpec.describe "Search Pagination" do
18
18
  click_on "Next »"
19
19
  end
20
20
  within "#sortAndPerPage" do
21
- expect(page).to have_text "11 - 20 of "
21
+ expect(page).to have_content "11 - 20 of "
22
22
  click_on "« Previous"
23
23
  end
24
24
  within "#sortAndPerPage" do
25
- expect(page).to have_text "1 - 10 of "
25
+ expect(page).to have_content "1 - 10 of "
26
26
  end
27
27
  end
28
28
 
@@ -31,14 +31,14 @@ RSpec.describe "Search Pagination" do
31
31
  fill_in "q", with: ''
32
32
  click_on 'search'
33
33
  within ("#sortAndPerPage") do
34
- expect(page).to have_text "1 - 10 of "
34
+ expect(page).to have_content "1 - 10 of "
35
35
  end
36
36
 
37
37
  within ("#per_page-dropdown") do
38
38
  click_on '20'
39
39
  end
40
40
  within ("#sortAndPerPage") do
41
- expect(page).to have_text "1 - 20 of "
41
+ expect(page).to have_content "1 - 20 of "
42
42
  end
43
43
  end
44
44
 
@@ -61,7 +61,7 @@ RSpec.describe "Search Pagination" do
61
61
  fill_in "q", with: ''
62
62
  click_on 'search'
63
63
  within ("#sortAndPerPage") do
64
- expect(page).to have_text "1 - 15 of "
64
+ expect(page).to have_content "1 - 15 of "
65
65
  within '#per_page-dropdown' do
66
66
  expect(page).to have_link('15')
67
67
  expect(page).to have_link('30')
@@ -71,7 +71,7 @@ RSpec.describe "Search Pagination" do
71
71
  click_on '30'
72
72
  end
73
73
  within ("#sortAndPerPage") do
74
- expect(page).to have_text "1 - 30 of "
74
+ expect(page).to have_content "1 - 30 of "
75
75
  end
76
76
  end
77
77
  end
@@ -84,13 +84,13 @@ RSpec.describe "Search Pagination" do
84
84
  click_on "Next »"
85
85
  end
86
86
  within "#sortAndPerPage" do
87
- expect(page).to have_text "11 - 20 of "
87
+ expect(page).to have_content "11 - 20 of "
88
88
  end
89
89
  within ("#per_page-dropdown") do
90
90
  click_on '20'
91
91
  end
92
92
  within "#sortAndPerPage" do
93
- expect(page).to have_text "1 - 20 of "
93
+ expect(page).to have_content "1 - 20 of "
94
94
  end
95
95
  end
96
96
  end
@@ -44,7 +44,7 @@ RSpec.describe "Search Results" do
44
44
 
45
45
  it "provides search hints if there are no results" do
46
46
  search_for 'asdfghj'
47
- expect(page).to have_text "No results found for your search"
47
+ expect(page).to have_content "No results found for your search"
48
48
  end
49
49
 
50
50
  it "provides search hints if there are no results" do
@@ -52,8 +52,8 @@ RSpec.describe "Search Results" do
52
52
  fill_in "q", with: "inmul"
53
53
  select "Author", from: "search_field"
54
54
  click_on 'search'
55
- expect(page).to have_text "No results found for your search"
56
- expect(page).to have_text "you searched by Author"
55
+ expect(page).to have_content "No results found for your search"
56
+ expect(page).to have_content "you searched by Author"
57
57
  click_on "try searching everything"
58
58
  expect(page).to have_xpath("//a[contains(@href, 77826928)]")
59
59
  end
@@ -6,17 +6,17 @@ RSpec.describe "Search Sort" do
6
6
  within "#facet-language_ssim" do
7
7
  click_on 'English'
8
8
  end
9
- expect(page).to have_text 'Sort by relevance'
9
+ expect(page).to have_content 'Sort by relevance'
10
10
  click_on 'title'
11
- expect(page).to have_text 'Sort by title'
11
+ expect(page).to have_content 'Sort by title'
12
12
  end
13
13
 
14
14
  it "sorts on search" do
15
15
  visit root_path
16
16
  fill_in "q", with: 'bod'
17
17
  click_on 'search'
18
- expect(page).to have_text 'Sort by relevance'
18
+ expect(page).to have_content 'Sort by relevance'
19
19
  click_on 'title'
20
- expect(page).to have_text 'Sort by title'
20
+ expect(page).to have_content 'Sort by title'
21
21
  end
22
22
  end
@@ -18,7 +18,7 @@ RSpec.describe "Search Page" do
18
18
  expect(page).to have_css("button[type='submit'] .submit-search-text")
19
19
  expect(page).to have_no_link "Start Over"
20
20
 
21
- expect(page).to have_text "Welcome!"
21
+ expect(page).to have_content "Welcome!"
22
22
  tmp_value = Capybara.ignore_hidden_elements
23
23
  Capybara.ignore_hidden_elements = false
24
24
  expect(page).to have_css("link[rel=stylesheet]")
@@ -44,8 +44,8 @@ RSpec.describe "Search Page" do
44
44
  Capybara.ignore_hidden_elements = tmp_value
45
45
 
46
46
  within "#appliedParams" do
47
- expect(page).to have_text "You searched for:"
48
- expect(page).to have_text "history"
47
+ expect(page).to have_content "You searched for:"
48
+ expect(page).to have_content "history"
49
49
  end
50
50
 
51
51
  within ("select#search_field") do
@@ -53,8 +53,8 @@ RSpec.describe "Search Page" do
53
53
  end
54
54
 
55
55
  within ("#sortAndPerPage") do
56
- expect(page).to have_text "Sort by"
57
- expect(page).to have_text "1 - 10 of 11"
56
+ expect(page).to have_content "Sort by"
57
+ expect(page).to have_content "1 - 10 of 11"
58
58
  within '#sort-dropdown' do
59
59
  expect(page).to have_link('relevance')
60
60
  expect(page).to have_link('year')
@@ -74,18 +74,18 @@ RSpec.describe "Search Page" do
74
74
  click_on 'search'
75
75
 
76
76
  within "#appliedParams" do
77
- expect(page).to have_text "You searched for:"
78
- expect(page).to have_text "Title"
79
- expect(page).to have_text "inmul"
77
+ expect(page).to have_content "You searched for:"
78
+ expect(page).to have_content "Title"
79
+ expect(page).to have_content "inmul"
80
80
  end
81
81
  within ("select#search_field") do
82
82
  expect(page).to have_css("option[selected]", text: "Title")
83
83
  end
84
84
  within(".index_title") do
85
- expect(page).to have_text "1."
85
+ expect(page).to have_content "1."
86
86
  end
87
87
  within ("#sortAndPerPage") do
88
- expect(page).to have_text "1 entry found"
88
+ expect(page).to have_content "1 entry found"
89
89
  end
90
90
  end
91
91
 
@@ -94,8 +94,8 @@ RSpec.describe "Search Page" do
94
94
  fill_in "q", with: 'history'
95
95
  click_on 'search'
96
96
  within "#documents" do
97
- expect(page).to have_text "次按驟變"
98
- expect(page).to have_text "DK861.K3 V5"
97
+ expect(page).to have_content "次按驟變"
98
+ expect(page).to have_content "DK861.K3 V5"
99
99
  end
100
100
  end
101
101
 
@@ -104,15 +104,15 @@ RSpec.describe "Search Page" do
104
104
  fill_in "q", with: 'history'
105
105
  click_on 'search'
106
106
  within "#appliedParams" do
107
- expect(page).to have_text "You searched for:"
108
- expect(page).to have_text "history"
107
+ expect(page).to have_content "You searched for:"
108
+ expect(page).to have_content "history"
109
109
  end
110
110
 
111
111
  expect(page).to have_css "#q[value='history']"
112
112
 
113
113
  click_on "Start Over"
114
114
 
115
- expect(page).to have_text "Welcome!"
115
+ expect(page).to have_content "Welcome!"
116
116
  expect(page).to have_no_css "#q[value='history']"
117
117
  end
118
118
  end
@@ -93,15 +93,6 @@ RSpec.describe Blacklight::ConfigurationHelperBehavior do
93
93
  end
94
94
  end
95
95
 
96
- describe "#per_page_options_for_select" do
97
- it "is the per-page values formatted as options_for_select" do
98
- allow(helper).to receive_messages(blacklight_config: double(per_page: [11, 22, 33]))
99
- expect(helper.per_page_options_for_select).to include ["11<span class=\"sr-only visually-hidden\"> per page</span>", 11]
100
- expect(helper.per_page_options_for_select).to include ["22<span class=\"sr-only visually-hidden\"> per page</span>", 22]
101
- expect(helper.per_page_options_for_select).to include ["33<span class=\"sr-only visually-hidden\"> per page</span>", 33]
102
- end
103
- end
104
-
105
96
  describe "#should_render_field?" do
106
97
  let(:field_config) { double('field config', if: true, unless: false) }
107
98
 
@@ -31,7 +31,7 @@ RSpec.describe Blacklight::RenderPartialsHelperBehavior do
31
31
  end
32
32
  end
33
33
 
34
- describe "#render_document_partials" do
34
+ describe "#render_document_partial" do
35
35
  let(:doc) { double }
36
36
 
37
37
  before do
@@ -35,17 +35,17 @@ RSpec.describe Blacklight::UrlHelperBehavior do
35
35
  it "builds a link tag to catalog using session[:search] for query params" do
36
36
  allow(helper).to receive(:current_search_session).and_return double(query_params: query_params)
37
37
  tag = helper.link_back_to_catalog
38
- expect(tag).to include('q=query')
39
- expect(tag).to include('f=facets')
40
- expect(tag).not_to include('page=')
41
- expect(tag).not_to include('per_page=')
38
+ expect(tag).to match /q=query/
39
+ expect(tag).to match /f=facets/
40
+ expect(tag).not_to match /page=/
41
+ expect(tag).not_to match /per_page=/
42
42
  end
43
43
 
44
44
  it "builds a link tag to bookmarks using session[:search] for query params" do
45
45
  allow(helper).to receive(:current_search_session).and_return double(query_params: bookmarks_query_params)
46
46
  tag = helper.link_back_to_catalog
47
- expect(tag).to include('Back to Bookmarks')
48
- expect(tag).to include('/bookmarks')
47
+ expect(tag).to match /Back to Bookmarks/
48
+ expect(tag).to match %r{/bookmarks}
49
49
  end
50
50
 
51
51
  context "with a search context" do
@@ -53,16 +53,16 @@ RSpec.describe Blacklight::UrlHelperBehavior do
53
53
  allow(helper).to receive_messages(current_search_session: double(query_params: query_params))
54
54
  allow(helper).to receive_messages(search_session: { 'per_page' => 15, 'counter' => 31 })
55
55
  tag = helper.link_back_to_catalog
56
- expect(tag).to include('page=3')
57
- expect(tag).to include('per_page=15')
56
+ expect(tag).to match /page=3/
57
+ expect(tag).to match /per_page=15/
58
58
  end
59
59
 
60
60
  it "omits per_page if the value is the same as the default" do
61
61
  allow(helper).to receive_messages(current_search_session: double(query_params: query_params))
62
62
  allow(helper).to receive_messages(search_session: { 'per_page' => 10, 'counter' => 31 })
63
63
  tag = helper.link_back_to_catalog
64
- expect(tag).to include('page=4')
65
- expect(tag).not_to include('per_page=')
64
+ expect(tag).to match /page=4/
65
+ expect(tag).not_to match /per_page=/
66
66
  end
67
67
  end
68
68
 
@@ -92,8 +92,8 @@ RSpec.describe Blacklight::UrlHelperBehavior do
92
92
  expect(my_engine).to receive(:url_for)
93
93
  .with({ q: "query", f: "facets", controller: "catalog" })
94
94
  .and_return('link-url')
95
- expect(tag).to include('Back to Search')
96
- expect(tag).to include('link-url')
95
+ expect(tag).to match /Back to Search/
96
+ expect(tag).to match /link-url/
97
97
  end
98
98
  end
99
99
  end
@@ -130,11 +130,11 @@ RSpec.describe Blacklight::UrlHelperBehavior do
130
130
  end
131
131
 
132
132
  it "passes on the title attribute to the link_to_with_data method" do
133
- expect(helper.link_to_document(document, "Some crazy long label...", title: "Some crazy longer label")).to include('title="Some crazy longer label"')
133
+ expect(helper.link_to_document(document, "Some crazy long label...", title: "Some crazy longer label")).to match(/title="Some crazy longer label"/)
134
134
  end
135
135
 
136
136
  it "doesn't add an erroneous title attribute if one isn't provided" do
137
- expect(helper.link_to_document(document, "Some crazy long label...")).not_to include('title=')
137
+ expect(helper.link_to_document(document, "Some crazy long label...")).not_to match(/title=/)
138
138
  end
139
139
 
140
140
  context "with an integer id" do
@@ -172,12 +172,6 @@ RSpec.describe BlacklightHelper do
172
172
  end
173
173
 
174
174
  it "ignores missing templates" do
175
- # In ViewComponent 3.25.0+, collection components rendered from a plain
176
- # ActionView template fall back to controller.view_context for helpers
177
- # instead of the stubbed helper. Workaround not needed on 2.x or 4.x.
178
- if ViewComponent::VERSION::MAJOR == 3
179
- allow(controller).to receive(:view_context).and_return(helper)
180
- end
181
175
  blacklight_config.view.view_type(partials: %w[index_header a b])
182
176
 
183
177
  response = helper.render_document_index_with_view :view_type, [obj1, obj1]
@@ -135,9 +135,9 @@ RSpec.describe CatalogHelper do
135
135
 
136
136
  it "calls url_for on the engine scope" do
137
137
  expect(my_engine).to receive(:url_for).and_return('/rss-path')
138
- expect(tag).to include('title="RSS for results"')
139
- expect(tag).to include('rel="alternate"')
140
- expect(tag).to include('type="application/rss+xml"')
138
+ expect(tag).to match /title="RSS for results"/
139
+ expect(tag).to match /rel="alternate"/
140
+ expect(tag).to match %r{type="application/rss\+xml"}
141
141
  end
142
142
  end
143
143
  end
@@ -157,9 +157,9 @@ RSpec.describe CatalogHelper do
157
157
 
158
158
  it "calls url_for on the engine scope" do
159
159
  expect(my_engine).to receive(:url_for).and_return('/atom-path')
160
- expect(tag).to include('title="Atom for results"')
161
- expect(tag).to include('rel="alternate"')
162
- expect(tag).to include('type="application/atom+xml"')
160
+ expect(tag).to match /title="Atom for results"/
161
+ expect(tag).to match /rel="alternate"/
162
+ expect(tag).to match %r{type="application/atom\+xml"}
163
163
  end
164
164
  end
165
165
  end
@@ -164,12 +164,5 @@ RSpec.describe Blacklight::OpenStructWithHashAccess do
164
164
  it "works (and doesn't throw a stack error...)" do
165
165
  expect(subject.try(:a)).to eq 1
166
166
  end
167
-
168
- it "passes a block to the method indicated" do
169
- acc = []
170
- test_block = proc { |n, v| acc << [n, v] }
171
- expect(subject.try(:each_pair, &test_block)).to be subject
172
- expect(acc).to eq [[:a, 1]]
173
- end
174
167
  end
175
168
  end
@@ -52,7 +52,7 @@ RSpec.describe Blacklight::Parameters do
52
52
  let(:search_state) { Blacklight::SearchState.new(query_params, blacklight_config) }
53
53
  let(:blacklight_config) { Blacklight::Configuration.new }
54
54
 
55
- context 'with facebook\'s badly mangled query parameters' do
55
+ context 'with facebooks badly mangled query parameters' do
56
56
  let(:query_params) do
57
57
  ActionController::Parameters.new(
58
58
  f: { field: { '0': 'first', '1': 'second' } },
@@ -67,17 +67,6 @@ RSpec.describe Blacklight::Parameters do
67
67
  it 'normalizes the facets to the expected format' do
68
68
  expect(params.permit_search_params.to_h.with_indifferent_access).to include f: { field: %w[first second] }, f_inclusive: { field: %w[first second] }
69
69
  end
70
-
71
- context 'when several fields are configured' do
72
- before do
73
- blacklight_config.add_facet_field 'other_field'
74
- blacklight_config.add_facet_field 'some_other_pivot_field', pivot: %w[abc def]
75
- end
76
-
77
- it 'normalizes the facets to the expected format' do
78
- expect(params.permit_search_params.to_h.with_indifferent_access).to include f: { field: %w[first second] }, f_inclusive: { field: %w[first second] }
79
- end
80
- end
81
70
  end
82
71
 
83
72
  context 'with filter_search_state_fields set to false' do
@@ -198,22 +198,4 @@ RSpec.describe Blacklight::SearchState::FilterField do
198
198
  expect(search_state.filter('some_field').include?(OpenStruct.new(value: '1'))).to be true
199
199
  end
200
200
  end
201
-
202
- describe '#permitted_params' do
203
- context 'with a pivot facet' do
204
- let(:blacklight_config) do
205
- Blacklight::Configuration.new.configure do |config|
206
- config.add_facet_field 'my_pivot', pivot: %w[format language_ssim]
207
- end
208
- end
209
-
210
- it 'marks all the pivot fields as permitted' do
211
- field = described_class.new blacklight_config.facet_fields['my_pivot'], search_state
212
- expect(field.permitted_params).to eq({
213
- f: { "-format" => [], "-language_ssim" => [], "format" => [], "language_ssim" => [] },
214
- f_inclusive: { "format" => [], "language_ssim" => [] }
215
- })
216
- end
217
- end
218
- end
219
201
  end
@@ -73,7 +73,7 @@ RSpec.describe Blacklight::SearchState::PivotFilterField do
73
73
  new_state = filter.remove(value_class.new(fq: { some_other_field: '3' }, value: '1'))
74
74
 
75
75
  expect(new_state.params[:f]).not_to include :some_other_field
76
- expect(new_state.filter('pivot_field').values&.map(&:fq)).to eql([{ some_other_field: nil }])
76
+ expect(new_state.filter('pivot_field').values&.map(&:fq)).to eql([some_other_field: nil])
77
77
  end
78
78
 
79
79
  it 'removes the filter parameter entirely if there are no filters left' do
@@ -64,5 +64,12 @@ RSpec.describe Blacklight::Solr::Request, :api do
64
64
 
65
65
  expect(subject.dig('json', 'query', 'bool', 'must')).to contain_exactly('some query', 'also required')
66
66
  end
67
+
68
+ it 'filters out empty query' do
69
+ subject['q'] = ""
70
+ subject.append_boolean_query :must, 'present query'
71
+
72
+ expect(subject.dig('json', 'query', 'bool', 'must')).to contain_exactly('present query')
73
+ end
67
74
  end
68
75
  end
@@ -41,7 +41,7 @@ RSpec.describe RecordMailer do
41
41
  end
42
42
 
43
43
  it "puts the title of the item in the subject" do
44
- expect(email.subject).to include('The horn')
44
+ expect(email.subject).to match /The horn/
45
45
  end
46
46
 
47
47
  it "has the correct from address (w/o the port number)" do
@@ -49,8 +49,8 @@ RSpec.describe RecordMailer do
49
49
  end
50
50
 
51
51
  it "prints out the correct body" do
52
- expect(email.body).to include('Title: The horn')
53
- expect(email.body).to include('Author: Janetzky, Kurt')
52
+ expect(email.body).to match /Title: The horn/
53
+ expect(email.body).to match /Author: Janetzky, Kurt/
54
54
  expect(email.body).to match /projectblacklight.org/
55
55
  end
56
56
 
@@ -104,8 +104,8 @@ RSpec.describe RecordMailer do
104
104
  end
105
105
 
106
106
  it "prints out the correct body" do
107
- expect(@sms.body).to include('Title: The horn')
108
- expect(@sms.body).to include('Author: Janetzky, Kurt')
107
+ expect(@sms.body).to match /Title: The horn/
108
+ expect(@sms.body).to match /Author: Janetzky, Kurt/
109
109
  expect(@sms.body).to match /projectblacklight.org:3000/
110
110
  end
111
111
 
@@ -37,11 +37,7 @@ RSpec.describe SolrDocument, :api do
37
37
  title_tesim: ['Good Omens'])
38
38
  end
39
39
 
40
- if RUBY_VERSION > '3.4'
41
- it { is_expected.to end_with "_source: {\"id\" => \"123\", \"title_tesim\" => [\"Good Omens\"]}>" }
42
- else
43
- it { is_expected.to end_with "_source: {\"id\"=>\"123\", \"title_tesim\"=>[\"Good Omens\"]}>" }
44
- end
40
+ it { is_expected.to end_with "_source: {\"id\"=>\"123\", \"title_tesim\"=>[\"Good Omens\"]}>" }
45
41
  end
46
42
 
47
43
  describe '.attribute' do
@@ -2,7 +2,6 @@
2
2
 
3
3
  RSpec.describe Blacklight::IndexPresenter, :api do
4
4
  include Capybara::RSpecMatchers
5
-
6
5
  subject { presenter }
7
6
 
8
7
  let(:request_context) { double(document_index_view_type: 'list') }
@@ -2,7 +2,6 @@
2
2
 
3
3
  RSpec.describe Blacklight::Rendering::Pipeline do
4
4
  include Capybara::RSpecMatchers
5
-
6
5
  let(:document) { instance_double(SolrDocument) }
7
6
  let(:context) { double }
8
7
  let(:options) { {} }
@@ -2,7 +2,6 @@
2
2
 
3
3
  RSpec.describe Blacklight::ShowPresenter, :api do
4
4
  include Capybara::RSpecMatchers
5
-
6
5
  subject { presenter }
7
6
 
8
7
  let(:request_context) { double }
@@ -2,7 +2,6 @@
2
2
 
3
3
  RSpec.describe Blacklight::ThumbnailPresenter do
4
4
  include Capybara::RSpecMatchers
5
-
6
5
  let(:view_context) { double "View context" }
7
6
  let(:config) { Blacklight::Configuration.new.view_config(:index) }
8
7
  let(:presenter) { described_class.new(document, view_context, config) }
@@ -59,7 +59,7 @@ RSpec.describe Blacklight::SearchService, :api do
59
59
  allow(blacklight_config).to receive(:default_solr_params).and_return(qt: 'custom_request_handler')
60
60
  allow(blacklight_solr).to receive(:send_and_receive) do |path, params|
61
61
  expect(path).to eq 'select'
62
- expect(params[:params]['facet.field']).to contain_exactly "format", "{!ex=pub_date_ssim_single}pub_date_ssim", "subject_ssim", "language_ssim", "lc_1letter_ssim", "subject_geo_ssim", "subject_era_ssim"
62
+ expect(params[:params]['facet.field']).to eq ["format", "{!ex=pub_date_ssim_single}pub_date_ssim", "subject_ssim", "language_ssim", "lc_1letter_ssim", "subject_geo_ssim", "subject_era_ssim"]
63
63
  expect(params[:params]["facet.query"]).to eq ["pub_date_ssim:[#{5.years.ago.year} TO *]", "pub_date_ssim:[#{10.years.ago.year} TO *]", "pub_date_ssim:[#{25.years.ago.year} TO *]"]
64
64
  expect(params[:params]).to include('rows' => 10, 'qt' => "custom_request_handler", 'q' => "", "f.subject_ssim.facet.limit" => 21, 'sort' => "score desc, pub_date_si desc, title_si asc")
65
65
  end.and_return('response' => { 'docs' => [] })
@@ -2,7 +2,7 @@
2
2
 
3
3
  module PresenterTestHelpers
4
4
  def controller
5
- @controller ||= ApplicationController.new.tap { |c| c.request = request }.extend(Rails.application.routes.url_helpers)
5
+ @controller ||= ViewComponent::Base.test_controller.constantize.new.tap { |c| c.request = request }.extend(Rails.application.routes.url_helpers)
6
6
  end
7
7
 
8
8
  def request
@@ -17,9 +17,9 @@ RSpec.describe "catalog/_document" do
17
17
  stub_template "catalog/_b_default.html.erb" => "b_partial"
18
18
  stub_template "catalog/_c_default.html.erb" => "c_partial"
19
19
  render partial: "catalog/document", locals: { document: document, document_counter: 1, view_config: blacklight_config.index }
20
- expect(rendered).to include('a_partial')
21
- expect(rendered).to include('b_partial')
22
- expect(rendered).to include('c_partial')
20
+ expect(rendered).to match /a_partial/
21
+ expect(rendered).to match /b_partial/
22
+ expect(rendered).to match /c_partial/
23
23
  end
24
24
 
25
25
  context 'with a configured document component' do
@@ -39,7 +39,7 @@ RSpec.describe "catalog/_document" do
39
39
 
40
40
  it 'renders the document component' do
41
41
  render partial: "catalog/document", locals: { document: document, document_counter: 1, view_config: blacklight_config.index }
42
- expect(rendered).to include('blah')
42
+ expect(rendered).to match /blah/
43
43
  end
44
44
  end
45
45
  end
@@ -28,14 +28,14 @@ RSpec.describe "catalog/facet_layout" do
28
28
  it "is collapsable" do
29
29
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
30
30
  expect(rendered).to have_css 'button.collapsed[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="false"]'
31
- expect(rendered).to have_css '.collapse .card-body'
31
+ expect(rendered).to have_css '.collapse .accordion-body'
32
32
  end
33
33
 
34
34
  it "is configured to be open by default" do
35
35
  allow(facet_field).to receive_messages(collapse: false)
36
36
  render partial: 'catalog/facet_layout', locals: { facet_field: facet_field }
37
37
  expect(rendered).to have_css 'button[data-toggle="collapse"][data-bs-toggle="collapse"][aria-expanded="true"]'
38
- expect(rendered).to have_no_css '.card-header.collapsed'
39
- expect(rendered).to have_css '.collapse.show .card-body'
38
+ expect(rendered).to have_no_css '.accordion-header.collapsed'
39
+ expect(rendered).to have_css '.collapse.show .accordion-body'
40
40
  end
41
41
  end
@@ -17,10 +17,10 @@ RSpec.describe "catalog/_sort_and_per_page" do
17
17
  stub_template "catalog/_per_page_widget.html.erb" => "per_page_widget"
18
18
  stub_template "catalog/_view_type_group.html.erb" => "view_type_group"
19
19
  render
20
- expect(rendered).to include('paginate_compact')
21
- expect(rendered).to include('sort_widget')
22
- expect(rendered).to include('per_page_widget')
23
- expect(rendered).to include('view_type_group')
20
+ expect(rendered).to match /paginate_compact/
21
+ expect(rendered).to match /sort_widget/
22
+ expect(rendered).to match /per_page_widget/
23
+ expect(rendered).to match /view_type_group/
24
24
  end
25
25
 
26
26
  it "does not render the pagination controls with bad limit values" do
@@ -30,6 +30,6 @@ RSpec.describe "catalog/_sort_and_per_page" do
30
30
  stub_template "catalog/_per_page_widget.html.erb" => "per_page_widget"
31
31
  stub_template "catalog/_view_type_group.html.erb" => "view_type_group"
32
32
  render
33
- expect(rendered).not_to include('paginate_compact')
33
+ expect(rendered).not_to match /paginate_compact/
34
34
  end
35
35
  end