blacklight 8.2.2 → 8.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.env +1 -1
  3. data/.github/workflows/ruby.yml +56 -62
  4. data/.rubocop.yml +226 -21
  5. data/VERSION +1 -1
  6. data/app/assets/stylesheets/blacklight/_mixins.scss +2 -17
  7. data/app/components/blacklight/facet_item_pivot_component.rb +2 -2
  8. data/app/components/blacklight/system/dropdown_component.rb +1 -1
  9. data/app/helpers/blacklight/catalog_helper_behavior.rb +1 -5
  10. data/app/helpers/blacklight/layout_helper_behavior.rb +3 -3
  11. data/app/views/shared/_flash_messages.html.erb +1 -1
  12. data/lib/blacklight/configuration.rb +1 -0
  13. data/lib/blacklight/nested_open_struct_with_hash_access.rb +2 -2
  14. data/lib/blacklight/solr/request.rb +1 -1
  15. data/lib/blacklight/solr/response/facets.rb +1 -1
  16. data/lib/blacklight/solr/search_builder_behavior.rb +1 -1
  17. data/package.json +1 -1
  18. data/spec/components/blacklight/advanced_search_form_component_spec.rb +2 -2
  19. data/spec/components/blacklight/constraint_layout_component_spec.rb +11 -11
  20. data/spec/components/blacklight/constraints_component_spec.rb +9 -9
  21. data/spec/components/blacklight/document/group_component_spec.rb +3 -3
  22. data/spec/components/blacklight/document/sidebar_component_spec.rb +3 -4
  23. data/spec/components/blacklight/document_component_spec.rb +21 -25
  24. data/spec/components/blacklight/facet_component_spec.rb +2 -2
  25. data/spec/components/blacklight/facet_field_checkboxes_component_spec.rb +5 -5
  26. data/spec/components/blacklight/facet_field_list_component_spec.rb +13 -13
  27. data/spec/components/blacklight/facet_item_component_spec.rb +5 -5
  28. data/spec/components/blacklight/facet_item_pivot_component_spec.rb +6 -6
  29. data/spec/components/blacklight/header_component_spec.rb +1 -2
  30. data/spec/components/blacklight/hidden_search_state_component_spec.rb +6 -6
  31. data/spec/components/blacklight/metadata_field_component_spec.rb +3 -3
  32. data/spec/components/blacklight/response/pagination_component_spec.rb +4 -4
  33. data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +1 -1
  34. data/spec/components/blacklight/search_context/server_item_pagination_component_spec.rb +1 -3
  35. data/spec/components/blacklight/system/flash_message_component_spec.rb +5 -5
  36. data/spec/controllers/blacklight/catalog_spec.rb +1 -1
  37. data/spec/controllers/blacklight/{catalog/component_configuration_spec.rb → configurable_spec.rb} +1 -1
  38. data/spec/controllers/bookmarks_controller_spec.rb +10 -10
  39. data/spec/controllers/catalog_controller_spec.rb +24 -26
  40. data/spec/features/advanced_search_spec.rb +14 -14
  41. data/spec/features/alternate_controller_spec.rb +9 -9
  42. data/spec/features/axe_spec.rb +4 -4
  43. data/spec/features/bookmarks_spec.rb +19 -19
  44. data/spec/features/citation_spec.rb +1 -1
  45. data/spec/features/did_you_mean_spec.rb +23 -23
  46. data/spec/features/facet_missing_spec.rb +9 -9
  47. data/spec/features/facets_spec.rb +21 -20
  48. data/spec/features/modal_spec.rb +4 -4
  49. data/spec/features/record_view_spec.rb +2 -2
  50. data/spec/features/search_context_spec.rb +6 -6
  51. data/spec/features/search_crawler_spec.rb +5 -5
  52. data/spec/features/search_filters_spec.rb +65 -65
  53. data/spec/features/search_history_spec.rb +12 -12
  54. data/spec/features/search_pagination_spec.rb +10 -10
  55. data/spec/features/search_results_spec.rb +1 -1
  56. data/spec/features/search_sort_spec.rb +4 -4
  57. data/spec/features/search_spec.rb +25 -25
  58. data/spec/features/sitelinks_search_box_spec.rb +2 -2
  59. data/spec/features/sms_spec.rb +1 -1
  60. data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +20 -3
  61. data/spec/helpers/blacklight/render_partials_helper_behavior_spec.rb +2 -1
  62. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +7 -8
  63. data/spec/helpers/blacklight_helper_spec.rb +13 -15
  64. data/spec/helpers/catalog_helper_spec.rb +3 -6
  65. data/spec/i18n_spec.rb +2 -1
  66. data/spec/lib/blacklight/search_state_spec.rb +4 -4
  67. data/spec/lib/tasks/blacklight_task_spec.rb +2 -1
  68. data/spec/models/blacklight/configurable_spec.rb +1 -1
  69. data/spec/models/blacklight/configuration/context_spec.rb +1 -1
  70. data/spec/models/blacklight/configuration_spec.rb +2 -2
  71. data/spec/models/blacklight/document/active_model_shim_spec.rb +1 -1
  72. data/spec/models/blacklight/document/cache_key_spec.rb +1 -1
  73. data/spec/models/blacklight/document_spec.rb +1 -1
  74. data/spec/models/blacklight/facet_paginator_spec.rb +14 -14
  75. data/spec/models/blacklight/icon_spec.rb +1 -1
  76. data/spec/models/blacklight/search_builder_spec.rb +1 -1
  77. data/spec/models/blacklight/solr/document_spec.rb +1 -1
  78. data/spec/models/blacklight/solr/facet_paginator_spec.rb +1 -1
  79. data/spec/models/blacklight/solr/repository_spec.rb +2 -2
  80. data/spec/models/blacklight/solr/request_spec.rb +1 -1
  81. data/spec/models/blacklight/solr/response/facets_spec.rb +1 -1
  82. data/spec/models/blacklight/solr/response/group_response_spec.rb +1 -1
  83. data/spec/models/blacklight/solr/response/group_spec.rb +1 -1
  84. data/spec/models/blacklight/solr/response_spec.rb +1 -1
  85. data/spec/models/blacklight/solr/{search_builder_spec.rb → search_builder_behavior_spec.rb} +9 -19
  86. data/spec/models/blacklight/suggest/response_spec.rb +1 -1
  87. data/spec/models/blacklight/suggest_search_spec.rb +1 -1
  88. data/spec/models/blacklight/user_spec.rb +1 -1
  89. data/spec/models/solr_document_spec.rb +1 -1
  90. data/spec/presenters/blacklight/document_presenter_spec.rb +1 -2
  91. data/spec/presenters/blacklight/field_presenter_spec.rb +1 -1
  92. data/spec/presenters/blacklight/index_presenter_spec.rb +2 -3
  93. data/spec/presenters/blacklight/json_presenter_spec.rb +1 -1
  94. data/spec/presenters/{pipeline_spec.rb → blacklight/rendering/pipeline_spec.rb} +1 -1
  95. data/spec/presenters/blacklight/show_presenter_spec.rb +5 -6
  96. data/spec/presenters/{thumbnail_presenter_spec.rb → blacklight/thumbnail_presenter_spec.rb} +5 -3
  97. data/spec/routing/catalog_routing_spec.rb +1 -1
  98. data/spec/services/blacklight/field_retriever_spec.rb +1 -1
  99. data/spec/services/blacklight/search_service_spec.rb +9 -9
  100. data/spec/spec_helper.rb +2 -2
  101. data/spec/support/features/search_helpers.rb +2 -2
  102. data/spec/support/features/session_helpers.rb +3 -3
  103. data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -2
  104. data/spec/views/catalog/_document.html.erb_spec.rb +1 -4
  105. data/spec/views/catalog/_document_list.html.erb_spec.rb +2 -2
  106. data/spec/views/catalog/_facet_index_navigation.html.erb_spec.rb +5 -6
  107. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +7 -7
  108. data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +4 -4
  109. data/spec/views/catalog/_show_sidebar.erb_spec.rb +1 -4
  110. data/spec/views/catalog/_show_tools.html.erb_spec.rb +1 -2
  111. data/spec/views/catalog/_view_type_group.html.erb_spec.rb +7 -7
  112. data/spec/views/catalog/email_success.html.erb_spec.rb +1 -1
  113. data/spec/views/catalog/facet.html.erb_spec.rb +1 -1
  114. data/spec/views/catalog/facet.json.jbuilder_spec.rb +1 -1
  115. data/spec/views/catalog/index.atom.builder_spec.rb +18 -19
  116. data/spec/views/catalog/index.html.erb_spec.rb +2 -4
  117. data/spec/views/catalog/index.json.jbuilder_spec.rb +5 -8
  118. data/spec/views/catalog/show.html.erb_spec.rb +3 -5
  119. data/spec/views/catalog/show.json.jbuilder_spec.rb +1 -2
  120. data/spec/views/catalog/sms_success.html.erb_spec.rb +1 -1
  121. data/spec/views/shared/_user_util_links.html.erb_spec.rb +2 -3
  122. metadata +10 -10
@@ -32,7 +32,7 @@ RSpec.describe Blacklight::AdvancedSearchFormComponent, type: :component do
32
32
  end
33
33
 
34
34
  it 'has text fields for each search field' do
35
- expect(rendered).to have_selector '.advanced-search-field', count: 4
35
+ expect(rendered).to have_css '.advanced-search-field', count: 4
36
36
  expect(rendered).to have_field 'clause_0_field', with: 'all_fields', type: :hidden
37
37
  expect(rendered).to have_field 'clause_1_field', with: 'title', type: :hidden
38
38
  expect(rendered).to have_field 'clause_2_field', with: 'author', type: :hidden
@@ -40,7 +40,7 @@ RSpec.describe Blacklight::AdvancedSearchFormComponent, type: :component do
40
40
  end
41
41
 
42
42
  it 'has filters' do
43
- expect(rendered).to have_selector '.blacklight-format'
43
+ expect(rendered).to have_css '.blacklight-format'
44
44
  expect(rendered).to have_field 'f_inclusive[format][]', with: 'Book'
45
45
  expect(rendered).to have_field 'f_inclusive[format][]', with: 'CD'
46
46
  end
@@ -13,11 +13,11 @@ RSpec.describe Blacklight::ConstraintLayoutComponent, type: :component do
13
13
  end
14
14
 
15
15
  it "renders label and value" do
16
- expect(rendered).to have_selector("span.applied-filter.constraint") do |s|
16
+ expect(rendered).to have_css("span.applied-filter.constraint") do |s|
17
17
  expect(s).to have_css("span.constraint-value")
18
- expect(s).not_to have_css("a.constraint-value")
19
- expect(s).to have_selector "span.filter-name", text: "my label"
20
- expect(s).to have_selector "span.filter-value", text: "my value"
18
+ expect(s).to have_no_css("a.constraint-value")
19
+ expect(s).to have_css "span.filter-name", text: "my label"
20
+ expect(s).to have_css "span.filter-value", text: "my value"
21
21
  end
22
22
  end
23
23
  end
@@ -28,14 +28,14 @@ RSpec.describe Blacklight::ConstraintLayoutComponent, type: :component do
28
28
  end
29
29
 
30
30
  it "includes remove link" do
31
- expect(rendered).to have_selector("span.applied-filter") do |s|
32
- expect(s).to have_selector(".remove[href='http://remove']")
31
+ expect(rendered).to have_css("span.applied-filter") do |s|
32
+ expect(s).to have_css(".remove[href='http://remove']")
33
33
  end
34
34
  end
35
35
 
36
36
  it "has an accessible remove label" do
37
- expect(rendered).to have_selector(".remove") do |s|
38
- expect(s).to have_selector('.visually-hidden', text: 'Remove constraint my label: my value')
37
+ expect(rendered).to have_css(".remove") do |s|
38
+ expect(s).to have_css('.visually-hidden', text: 'Remove constraint my label: my value')
39
39
  end
40
40
  end
41
41
  end
@@ -46,7 +46,7 @@ RSpec.describe Blacklight::ConstraintLayoutComponent, type: :component do
46
46
  end
47
47
 
48
48
  it "includes them" do
49
- expect(rendered).to have_selector("span.applied-filter.constraint.class1.class2")
49
+ expect(rendered).to have_css("span.applied-filter.constraint.class1.class2")
50
50
  end
51
51
  end
52
52
 
@@ -56,8 +56,8 @@ RSpec.describe Blacklight::ConstraintLayoutComponent, type: :component do
56
56
  end
57
57
 
58
58
  it "does not escape key and value" do
59
- expect(rendered).to have_selector("span.applied-filter.constraint span.filter-name span.custom_label")
60
- expect(rendered).to have_selector("span.applied-filter.constraint span.filter-value span.custom_value")
59
+ expect(rendered).to have_css("span.applied-filter.constraint span.filter-name span.custom_label")
60
+ expect(rendered).to have_css("span.applied-filter.constraint span.filter-value span.custom_value")
61
61
  end
62
62
  end
63
63
  end
@@ -36,15 +36,15 @@ RSpec.describe Blacklight::ConstraintsComponent, type: :component do
36
36
  end
37
37
 
38
38
  it 'has a header' do
39
- expect(rendered).to have_selector('h2', text: 'Search Constraints')
39
+ expect(rendered).to have_css('h2', text: 'Search Constraints')
40
40
  end
41
41
 
42
42
  it 'wraps the output in a div' do
43
- expect(rendered).to have_selector('div#appliedParams')
43
+ expect(rendered).to have_css('div#appliedParams')
44
44
  end
45
45
 
46
46
  it 'renders the query' do
47
- expect(rendered).to have_selector('.applied-filter.constraint', text: 'some query')
47
+ expect(rendered).to have_css('.applied-filter.constraint', text: 'some query')
48
48
  end
49
49
  end
50
50
 
@@ -52,15 +52,15 @@ RSpec.describe Blacklight::ConstraintsComponent, type: :component do
52
52
  let(:query_params) { { f: { some_facet: ['some value'] } } }
53
53
 
54
54
  it 'renders the query' do
55
- expect(rendered).to have_selector('.constraint-value > .filter-name', text: 'Some Facet').and(have_selector('.constraint-value > .filter-value', text: 'some value'))
55
+ expect(rendered).to have_css('.constraint-value > .filter-name', text: 'Some Facet').and(have_css('.constraint-value > .filter-value', text: 'some value'))
56
56
  end
57
57
 
58
58
  context 'that is not configured' do
59
59
  let(:query_params) { { f: { some_facet: ['some value'], missing: ['another value'] } } }
60
60
 
61
61
  it 'renders only the configured constraints' do
62
- expect(rendered).to have_selector('.constraint-value > .filter-name', text: 'Some Facet').and(have_selector('.constraint-value > .filter-value', text: 'some value'))
63
- expect(rendered).not_to have_selector('.constraint-value > .filter-name', text: 'Missing')
62
+ expect(rendered).to have_css('.constraint-value > .filter-name', text: 'Some Facet').and(have_css('.constraint-value > .filter-value', text: 'some value'))
63
+ expect(rendered).to have_no_css('.constraint-value > .filter-name', text: 'Missing')
64
64
  end
65
65
  end
66
66
  end
@@ -71,15 +71,15 @@ RSpec.describe Blacklight::ConstraintsComponent, type: :component do
71
71
  let(:query_params) { { q: 'some query', f: { some_facet: ['some value'] } } }
72
72
 
73
73
  it 'wraps the output in a span' do
74
- expect(rendered).to have_selector('span .constraint')
74
+ expect(rendered).to have_css('span .constraint')
75
75
  end
76
76
 
77
77
  it 'renders the search state as lightly-decorated text' do
78
- expect(rendered).to have_selector('.constraint > .filter-values', text: 'some query').and(have_selector('.constraint', text: 'Some Facet:some value'))
78
+ expect(rendered).to have_css('.constraint > .filter-values', text: 'some query').and(have_css('.constraint', text: 'Some Facet:some value'))
79
79
  end
80
80
 
81
81
  it 'omits the headers' do
82
- expect(rendered).not_to have_selector('h2', text: 'Search Constraints')
82
+ expect(rendered).to have_no_css('h2', text: 'Search Constraints')
83
83
  end
84
84
  end
85
85
  end
@@ -26,9 +26,9 @@ RSpec.describe Blacklight::Document::GroupComponent, type: :component do
26
26
  end
27
27
 
28
28
  it 'renders the group with a header' do
29
- expect(rendered).to have_selector 'div.group'
30
- expect(rendered).to have_selector 'h2', text: 'group1'
31
- expect(rendered).not_to have_link 'more'
29
+ expect(rendered).to have_css 'div.group'
30
+ expect(rendered).to have_css 'h2', text: 'group1'
31
+ expect(rendered).to have_no_link 'more'
32
32
  end
33
33
 
34
34
  it 'renders the group documents' do
@@ -26,8 +26,7 @@ RSpec.describe Blacklight::Document::SidebarComponent, type: :component do
26
26
 
27
27
  before do
28
28
  # Every call to view_context returns a different object. This ensures it stays stable.
29
- allow(controller).to receive(:view_context).and_return(view_context)
30
- allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
29
+ allow(controller).to receive_messages(view_context: view_context, blacklight_config: blacklight_config)
31
30
  end
32
31
 
33
32
  describe '#render_show_tools' do
@@ -42,7 +41,7 @@ RSpec.describe Blacklight::Document::SidebarComponent, type: :component do
42
41
  end
43
42
 
44
43
  it 'renders show_tools partial' do
45
- expect(rendered).to have_selector 'div[@class="expected-show_tools"]'
44
+ expect(rendered).to have_css 'div[@class="expected-show_tools"]'
46
45
  end
47
46
  end
48
47
 
@@ -55,7 +54,7 @@ RSpec.describe Blacklight::Document::SidebarComponent, type: :component do
55
54
  end
56
55
 
57
56
  it 'renders configured show_tools component' do
58
- expect(rendered).to have_selector 'div[@class="expected-show_tools"]'
57
+ expect(rendered).to have_css 'div[@class="expected-show_tools"]'
59
58
  end
60
59
  end
61
60
  # rubocop:enable RSpec/SubjectStub
@@ -36,12 +36,8 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
36
36
 
37
37
  before do
38
38
  # Every call to view_context returns a different object. This ensures it stays stable.
39
- allow(controller).to receive(:view_context).and_return(view_context)
40
- allow(controller).to receive(:current_or_guest_user).and_return(User.new)
41
- allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
42
- allow(view_context).to receive(:search_session).and_return({})
43
- allow(view_context).to receive(:current_search_session).and_return(nil)
44
- allow(view_context).to receive(:current_bookmarks).and_return([])
39
+ allow(controller).to receive_messages(view_context: view_context, current_or_guest_user: User.new, blacklight_config: blacklight_config)
40
+ allow(view_context).to receive_messages(search_session: {}, current_search_session: nil, current_bookmarks: [])
45
41
  end
46
42
 
47
43
  it 'has some defined content areas' do
@@ -61,8 +57,8 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
61
57
  it 'has schema.org properties' do
62
58
  component.set_slot(:body) { '-' }
63
59
 
64
- expect(rendered).to have_selector 'article[@itemtype="http://schema.org/Thing"]'
65
- expect(rendered).to have_selector 'article[@itemscope]'
60
+ expect(rendered).to have_css 'article[@itemtype="http://schema.org/Thing"]'
61
+ expect(rendered).to have_css 'article[@itemscope]'
66
62
  end
67
63
 
68
64
  context 'with a provided body' do
@@ -70,8 +66,8 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
70
66
  component.set_slot(:body) { 'Body content' }
71
67
 
72
68
  expect(rendered).to have_content 'Body content'
73
- expect(rendered).not_to have_selector 'header'
74
- expect(rendered).not_to have_selector 'dl'
69
+ expect(rendered).to have_no_css 'header'
70
+ expect(rendered).to have_no_css 'dl'
75
71
  end
76
72
  end
77
73
 
@@ -85,8 +81,8 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
85
81
  it 'has data properties' do
86
82
  component.set_slot(:body) { '-' }
87
83
 
88
- expect(rendered).to have_selector 'article[@data-document-id="x"]'
89
- expect(rendered).to have_selector 'article[@data-document-counter="5"]'
84
+ expect(rendered).to have_css 'article[@data-document-id="x"]'
85
+ expect(rendered).to have_css 'article[@data-document-counter="5"]'
90
86
  end
91
87
 
92
88
  it 'renders a linked title' do
@@ -94,7 +90,7 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
94
90
  end
95
91
 
96
92
  it 'renders a counter with the title' do
97
- expect(rendered).to have_selector 'header', text: '5. Title'
93
+ expect(rendered).to have_css 'header', text: '5. Title'
98
94
  end
99
95
 
100
96
  context 'with a document rendered as part of a collection' do
@@ -104,24 +100,24 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
104
100
 
105
101
  it 'renders a counter with the title' do
106
102
  # after ViewComponent 2.5, collection counter params are 1-indexed
107
- expect(rendered).to have_selector 'header', text: '111. Title'
103
+ expect(rendered).to have_css 'header', text: '111. Title'
108
104
  end
109
105
  end
110
106
 
111
107
  it 'renders actions' do
112
- expect(rendered).to have_selector '.index-document-functions'
108
+ expect(rendered).to have_css '.index-document-functions'
113
109
  end
114
110
 
115
111
  it 'renders a thumbnail' do
116
- expect(rendered).to have_selector 'a[href="/catalog/x"] img[src="http://example.com/image.jpg"]'
112
+ expect(rendered).to have_css 'a[href="/catalog/x"] img[src="http://example.com/image.jpg"]'
117
113
  end
118
114
 
119
115
  context 'with default metadata component' do
120
116
  it 'renders metadata' do
121
- expect(rendered).to have_selector 'dl.document-metadata'
122
- expect(rendered).to have_selector 'dt', text: 'Title:'
123
- expect(rendered).to have_selector 'dd', text: 'Title'
124
- expect(rendered).not_to have_selector 'dt', text: 'ISBN:'
117
+ expect(rendered).to have_css 'dl.document-metadata'
118
+ expect(rendered).to have_css 'dt', text: 'Title:'
119
+ expect(rendered).to have_css 'dd', text: 'Title'
120
+ expect(rendered).to have_no_css 'dt', text: 'ISBN:'
125
121
  end
126
122
  end
127
123
  end
@@ -136,17 +132,17 @@ RSpec.describe Blacklight::DocumentComponent, type: :component do
136
132
  it 'renders with an id' do
137
133
  component.set_slot(:body) { '-' }
138
134
 
139
- expect(rendered).to have_selector 'article#document'
135
+ expect(rendered).to have_css 'article#document'
140
136
  end
141
137
 
142
138
  it 'renders a title' do
143
- expect(rendered).to have_selector 'h1', text: 'Title'
139
+ expect(rendered).to have_css 'h1', text: 'Title'
144
140
  end
145
141
 
146
142
  it 'renders with show-specific metadata' do
147
- expect(rendered).to have_selector 'dl.document-metadata'
148
- expect(rendered).to have_selector 'dt', text: 'ISBN:'
149
- expect(rendered).to have_selector 'dd', text: 'Value'
143
+ expect(rendered).to have_css 'dl.document-metadata'
144
+ expect(rendered).to have_css 'dt', text: 'ISBN:'
145
+ expect(rendered).to have_css 'dd', text: 'Value'
150
146
  end
151
147
 
152
148
  it 'renders an embed' do
@@ -18,7 +18,7 @@ RSpec.describe Blacklight::FacetComponent, type: :component do
18
18
  let(:facet_config) { Blacklight::Configuration::FacetField.new(key: 'field').normalize! }
19
19
 
20
20
  it 'delegates to the configured component to render something' do
21
- expect(rendered).to have_selector 'ul.facet-values'
21
+ expect(rendered).to have_css 'ul.facet-values'
22
22
  end
23
23
 
24
24
  context 'with a provided component' do
@@ -52,7 +52,7 @@ RSpec.describe Blacklight::FacetComponent, type: :component do
52
52
  before do
53
53
  replace_hash = { 'catalog/_facet_partial.html.erb' => 'facet partial' }
54
54
 
55
- if ::Rails.version.to_f >= 7.1
55
+ if Rails.version.to_f >= 7.1
56
56
  controller.prepend_view_path(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for(replace_hash))
57
57
  else
58
58
  controller.view_context.view_paths.unshift(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for(replace_hash))
@@ -33,15 +33,15 @@ RSpec.describe Blacklight::FacetFieldCheckboxesComponent, type: :component do
33
33
  let(:params) { { f: { field: ['a'] } } }
34
34
 
35
35
  it 'renders a collapsible card' do
36
- expect(rendered).to have_selector '.card'
36
+ expect(rendered).to have_css '.card'
37
37
  expect(rendered).to have_button 'Field'
38
- expect(rendered).to have_selector 'button[data-bs-target="#facet-field"]'
39
- expect(rendered).to have_selector '#facet-field.collapse.show'
38
+ expect(rendered).to have_css 'button[data-bs-target="#facet-field"]'
39
+ expect(rendered).to have_css '#facet-field.collapse.show'
40
40
  end
41
41
 
42
42
  it 'renders the facet items' do
43
- expect(rendered).to have_selector 'ul.facet-values'
44
- expect(rendered).to have_selector 'li', count: 3
43
+ expect(rendered).to have_css 'ul.facet-values'
44
+ expect(rendered).to have_css 'li', count: 3
45
45
 
46
46
  expect(rendered).to have_field 'f_inclusive[field][]', with: 'a'
47
47
  expect(rendered).to have_field 'f_inclusive[field][]', with: 'b'
@@ -31,15 +31,15 @@ RSpec.describe Blacklight::FacetFieldListComponent, type: :component do
31
31
  end
32
32
 
33
33
  it 'renders a collapsible card' do
34
- expect(rendered).to have_selector '.card'
34
+ expect(rendered).to have_css '.card'
35
35
  expect(rendered).to have_button 'Field'
36
- expect(rendered).to have_selector 'button[data-bs-target="#facet-field"]'
37
- expect(rendered).to have_selector '#facet-field.collapse.show'
36
+ expect(rendered).to have_css 'button[data-bs-target="#facet-field"]'
37
+ expect(rendered).to have_css '#facet-field.collapse.show'
38
38
  end
39
39
 
40
40
  it 'renders the facet items' do
41
- expect(rendered).to have_selector 'ul.facet-values'
42
- expect(rendered).to have_selector 'li', count: 2
41
+ expect(rendered).to have_css 'ul.facet-values'
42
+ expect(rendered).to have_css 'li', count: 2
43
43
  end
44
44
 
45
45
  context 'with an active facet' do
@@ -58,7 +58,7 @@ RSpec.describe Blacklight::FacetFieldListComponent, type: :component do
58
58
  end
59
59
 
60
60
  it 'adds the facet-limit-active class' do
61
- expect(rendered).to have_selector 'div.facet-limit-active'
61
+ expect(rendered).to have_css 'div.facet-limit-active'
62
62
  end
63
63
  end
64
64
 
@@ -78,13 +78,13 @@ RSpec.describe Blacklight::FacetFieldListComponent, type: :component do
78
78
  end
79
79
 
80
80
  it 'renders a collapsed facet' do
81
- expect(rendered).to have_selector '.facet-content.collapse'
82
- expect(rendered).not_to have_selector '.facet-content.collapse.show'
81
+ expect(rendered).to have_css '.facet-content.collapse'
82
+ expect(rendered).to have_no_css '.facet-content.collapse.show'
83
83
  end
84
84
 
85
85
  it 'renders the toggle button in the collapsed state' do
86
- expect(rendered).to have_selector '.btn.collapsed'
87
- expect(rendered).to have_selector '.btn[aria-expanded="false"]'
86
+ expect(rendered).to have_css '.btn.collapsed'
87
+ expect(rendered).to have_css '.btn[aria-expanded="false"]'
88
88
  end
89
89
  end
90
90
 
@@ -134,11 +134,11 @@ RSpec.describe Blacklight::FacetFieldListComponent, type: :component do
134
134
 
135
135
  it 'displays the constraint above the list' do
136
136
  expect(rendered).to have_content 'Any of:'
137
- expect(rendered).to have_selector '.inclusive_or .facet-label', text: 'a'
137
+ expect(rendered).to have_css '.inclusive_or .facet-label', text: 'a'
138
138
  expect(rendered).to have_link '[remove]', href: 'http://test.host/catalog?f_inclusive%5Bfield%5D%5B%5D=b&f_inclusive%5Bfield%5D%5B%5D=c'
139
- expect(rendered).to have_selector '.inclusive_or .facet-label', text: 'b'
139
+ expect(rendered).to have_css '.inclusive_or .facet-label', text: 'b'
140
140
  expect(rendered).to have_link '[remove]', href: 'http://test.host/catalog?f_inclusive%5Bfield%5D%5B%5D=a&f_inclusive%5Bfield%5D%5B%5D=c'
141
- expect(rendered).to have_selector '.inclusive_or .facet-label', text: 'c'
141
+ expect(rendered).to have_css '.inclusive_or .facet-label', text: 'c'
142
142
  expect(rendered).to have_link '[remove]', href: 'http://test.host/catalog?f_inclusive%5Bfield%5D%5B%5D=a&f_inclusive%5Bfield%5D%5B%5D=b'
143
143
  end
144
144
  end
@@ -19,11 +19,11 @@ RSpec.describe Blacklight::FacetItemComponent, type: :component do
19
19
  end
20
20
 
21
21
  it 'links to the facet and shows the number of hits' do
22
- expect(rendered).to have_selector 'li'
22
+ expect(rendered).to have_css 'li'
23
23
  expect(rendered).to have_link 'x', href: '/catalog?f=x' do |link|
24
24
  link['rel'] == 'nofollow'
25
25
  end
26
- expect(rendered).to have_selector '.facet-count', text: '10'
26
+ expect(rendered).to have_css '.facet-count', text: '10'
27
27
  end
28
28
 
29
29
  context 'with a selected facet' do
@@ -39,12 +39,12 @@ RSpec.describe Blacklight::FacetItemComponent, type: :component do
39
39
  end
40
40
 
41
41
  it 'links to the facet and shows the number of hits' do
42
- expect(rendered).to have_selector 'li'
43
- expect(rendered).to have_selector '.selected', text: 'x'
42
+ expect(rendered).to have_css 'li'
43
+ expect(rendered).to have_css '.selected', text: 'x'
44
44
  expect(rendered).to have_link '[remove]', href: '/catalog' do |link|
45
45
  link['rel'] == 'nofollow'
46
46
  end
47
- expect(rendered).to have_selector '.selected.facet-count', text: '10'
47
+ expect(rendered).to have_css '.selected.facet-count', text: '10'
48
48
  end
49
49
  end
50
50
  end
@@ -34,13 +34,13 @@ RSpec.describe Blacklight::FacetItemPivotComponent, type: :component do
34
34
  let(:facet_config) { Blacklight::Configuration::NullField.new(key: 'z', item_component: Blacklight::FacetItemComponent, item_presenter: Blacklight::FacetItemPivotPresenter) }
35
35
 
36
36
  it 'links to the facet and shows the number of hits' do
37
- expect(rendered).to have_selector 'li'
37
+ expect(rendered).to have_css 'li'
38
38
  expect(rendered).to have_link 'x', href: nokogiri_mediated_href(facet_item.href)
39
- expect(rendered).to have_selector '.facet-count', text: '10'
39
+ expect(rendered).to have_css '.facet-count', text: '10'
40
40
  end
41
41
 
42
42
  it 'has the facet hierarchy' do
43
- expect(rendered).to have_selector 'li ul.pivot-facet'
43
+ expect(rendered).to have_css 'li ul.pivot-facet'
44
44
  expect(rendered).to have_link 'x:1', href: nokogiri_mediated_href(facet_item.facet_item_presenters.first.href)
45
45
  end
46
46
 
@@ -60,10 +60,10 @@ RSpec.describe Blacklight::FacetItemPivotComponent, type: :component do
60
60
  end
61
61
 
62
62
  it 'links to the facet and shows the number of hits' do
63
- expect(rendered).to have_selector 'li'
64
- expect(rendered).to have_selector '.selected', text: 'x'
63
+ expect(rendered).to have_css 'li'
64
+ expect(rendered).to have_css '.selected', text: 'x'
65
65
  expect(rendered).to have_link '[remove]', href: '/catalog'
66
- expect(rendered).to have_selector '.selected.facet-count', text: '10'
66
+ expect(rendered).to have_css '.selected.facet-count', text: '10'
67
67
  end
68
68
  end
69
69
  end
@@ -3,8 +3,7 @@
3
3
  RSpec.describe Blacklight::HeaderComponent, type: :component do
4
4
  before do
5
5
  with_controller_class(CatalogController) do
6
- allow(controller).to receive(:current_user).and_return(nil)
7
- allow(controller).to receive(:search_action_url).and_return('/search')
6
+ allow(controller).to receive_messages(current_user: nil, search_action_url: '/search')
8
7
  render
9
8
  end
10
9
  end
@@ -13,11 +13,11 @@ RSpec.describe Blacklight::HiddenSearchStateComponent, type: :component do
13
13
  let(:instance) { described_class.new(params: params) }
14
14
 
15
15
  it "converts a hash with nested complex data to Rails-style hidden form fields" do
16
- expect(rendered).to have_selector("input[type='hidden'][name='q'][value='query']", visible: :hidden)
17
- expect(rendered).to have_selector("input[type='hidden'][name='per_page'][value='10']", visible: :hidden)
18
- expect(rendered).to have_selector("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']", visible: :hidden)
19
- expect(rendered).to have_selector("input[type='hidden'][name='f[field2][]'][value='z']", visible: :hidden)
20
- expect(rendered).to have_selector("input[type='hidden'][name='f[field1][]'][value='a']", visible: :hidden)
21
- expect(rendered).to have_selector("input[type='hidden'][name='f[field1][]'][value='b']", visible: :hidden)
16
+ expect(rendered).to have_css("input[type='hidden'][name='q'][value='query']", visible: :hidden)
17
+ expect(rendered).to have_css("input[type='hidden'][name='per_page'][value='10']", visible: :hidden)
18
+ expect(rendered).to have_css("input[type='hidden'][name='extra_arbitrary_key'][value='arbitrary_value']", visible: :hidden)
19
+ expect(rendered).to have_css("input[type='hidden'][name='f[field2][]'][value='z']", visible: :hidden)
20
+ expect(rendered).to have_css("input[type='hidden'][name='f[field1][]'][value='a']", visible: :hidden)
21
+ expect(rendered).to have_css("input[type='hidden'][name='f[field1][]'][value='b']", visible: :hidden)
22
22
  end
23
23
  end
@@ -16,11 +16,11 @@ RSpec.describe Blacklight::MetadataFieldComponent, type: :component do
16
16
  end
17
17
 
18
18
  it 'renders the field label' do
19
- expect(rendered).to have_selector 'dt.blacklight-field', text: 'Field label'
19
+ expect(rendered).to have_css 'dt.blacklight-field', text: 'Field label'
20
20
  end
21
21
 
22
22
  it 'renders the field value' do
23
- expect(rendered).to have_selector 'dd.blacklight-field', text: 'Value'
23
+ expect(rendered).to have_css 'dd.blacklight-field', text: 'Value'
24
24
  end
25
25
 
26
26
  context 'from a show view' do
@@ -31,7 +31,7 @@ RSpec.describe Blacklight::MetadataFieldComponent, type: :component do
31
31
  it 'renders the right field label' do
32
32
  allow(field).to receive(:label).with('show').and_return('custom label')
33
33
 
34
- expect(rendered).to have_selector 'dt.blacklight-field', text: 'custom label'
34
+ expect(rendered).to have_css 'dt.blacklight-field', text: 'custom label'
35
35
  end
36
36
  end
37
37
  end
@@ -18,10 +18,10 @@ RSpec.describe Blacklight::Response::PaginationComponent, type: :component do
18
18
  before { render }
19
19
 
20
20
  it "has links to deep pages" do
21
- expect(page).not_to have_link '98'
21
+ expect(page).to have_no_link '98'
22
22
  expect(page).to have_link '99'
23
23
  expect(page).to have_link '100'
24
- expect(page).not_to have_link '101'
24
+ expect(page).to have_no_link '101'
25
25
  end
26
26
  end
27
27
 
@@ -32,7 +32,7 @@ RSpec.describe Blacklight::Response::PaginationComponent, type: :component do
32
32
 
33
33
  it "does not link to deep pages" do
34
34
  expect(page).to have_link '1'
35
- expect(page).not_to have_link '100'
35
+ expect(page).to have_no_link '100'
36
36
  end
37
37
  end
38
38
 
@@ -46,7 +46,7 @@ RSpec.describe Blacklight::Response::PaginationComponent, type: :component do
46
46
 
47
47
  it "does not link to deep pages" do
48
48
  expect(page).to have_link '1'
49
- expect(page).not_to have_link '100'
49
+ expect(page).to have_no_link '100'
50
50
  end
51
51
  end
52
52
  end
@@ -15,7 +15,7 @@ RSpec.describe Blacklight::SearchContext::ServerAppliedParamsComponent, type: :c
15
15
  # https://github.com/rspec/rspec-rails/commit/4d65bea0619955acb15023b9c3f57a3a53183da8
16
16
  # https://github.com/rspec/rspec-rails/issues/2696
17
17
  replace_hash = { 'application/_start_over.html.erb' => 'start over' }
18
- if ::Rails.version.to_f >= 7.1
18
+ if Rails.version.to_f >= 7.1
19
19
  controller.prepend_view_path(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for(replace_hash))
20
20
  else
21
21
  view_context.view_paths.unshift(RSpec::Rails::ViewExampleGroup::StubResolverCache.resolver_for(replace_hash))
@@ -30,10 +30,8 @@ RSpec.describe Blacklight::SearchContext::ServerItemPaginationComponent, type: :
30
30
 
31
31
  before do
32
32
  # allow(controller).to receive(:controller_tracking_method).and_return('track_catalog_path')
33
- allow(controller).to receive(:controller_name).and_return('catalog')
34
33
 
35
- allow(controller).to receive(:link_to_previous_document).and_return('')
36
- allow(controller).to receive(:link_to_next_document).and_return('')
34
+ allow(controller).to receive_messages(controller_name: 'catalog', link_to_previous_document: '', link_to_next_document: '')
37
35
  end
38
36
 
39
37
  it "renders content" do
@@ -17,14 +17,14 @@ RSpec.describe Blacklight::System::FlashMessageComponent, type: :component do
17
17
  let(:type) { 'whatever' }
18
18
 
19
19
  it 'renders a message inside an alert' do
20
- expect(rendered).to have_selector 'div.alert.alert-whatever', text: message
20
+ expect(rendered).to have_css 'div.alert.alert-whatever', text: message
21
21
  end
22
22
 
23
23
  context 'with a success message' do
24
24
  let(:type) { 'success' }
25
25
 
26
26
  it 'adds some styling' do
27
- expect(rendered).to have_selector 'div.alert-success'
27
+ expect(rendered).to have_css 'div.alert-success'
28
28
  end
29
29
  end
30
30
 
@@ -32,7 +32,7 @@ RSpec.describe Blacklight::System::FlashMessageComponent, type: :component do
32
32
  let(:type) { 'notice' }
33
33
 
34
34
  it 'adds some styling' do
35
- expect(rendered).to have_selector 'div.alert-info'
35
+ expect(rendered).to have_css 'div.alert-info'
36
36
  end
37
37
  end
38
38
 
@@ -40,7 +40,7 @@ RSpec.describe Blacklight::System::FlashMessageComponent, type: :component do
40
40
  let(:type) { 'alert' }
41
41
 
42
42
  it 'adds some styling' do
43
- expect(rendered).to have_selector 'div.alert-warning'
43
+ expect(rendered).to have_css 'div.alert-warning'
44
44
  end
45
45
  end
46
46
 
@@ -48,7 +48,7 @@ RSpec.describe Blacklight::System::FlashMessageComponent, type: :component do
48
48
  let(:type) { 'error' }
49
49
 
50
50
  it 'adds some styling' do
51
- expect(rendered).to have_selector 'div.alert-danger'
51
+ expect(rendered).to have_css 'div.alert-danger'
52
52
  end
53
53
  end
54
54
  end
@@ -8,7 +8,7 @@ RSpec.describe Blacklight::Catalog do
8
8
  describe "#search_state" do
9
9
  subject { controller.send(:search_state) }
10
10
 
11
- let(:raw_params) { HashWithIndifferentAccess.new a: 1 }
11
+ let(:raw_params) { ActiveSupport::HashWithIndifferentAccess.new a: 1 }
12
12
  let(:params) { ActionController::Parameters.new raw_params }
13
13
 
14
14
  before do
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- RSpec.describe CatalogController do
3
+ RSpec.describe Blacklight::Configurable do
4
4
  subject do
5
5
  Class.new do
6
6
  include Blacklight::Configurable