blacklight 8.0.0 → 8.1.0
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.
- checksums.yaml +4 -4
- data/.env +1 -1
- data/.github/workflows/ruby.yml +11 -0
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +67 -73
- data/VERSION +1 -1
- data/app/builders/blacklight/action_builder.rb +1 -1
- data/app/components/blacklight/advanced_search_form_component.html.erb +1 -1
- data/app/components/blacklight/advanced_search_form_component.rb +2 -2
- data/app/components/blacklight/document/sidebar_component.html.erb +1 -1
- data/app/components/blacklight/document/sidebar_component.rb +12 -0
- data/app/components/blacklight/response/pagination_component.html.erb +1 -1
- data/app/components/blacklight/response/pagination_component.rb +11 -2
- data/app/components/blacklight/search_bar_component.html.erb +1 -1
- data/app/controllers/concerns/blacklight/bookmarks.rb +1 -1
- data/app/helpers/blacklight/blacklight_helper_behavior.rb +10 -0
- data/app/models/concerns/blacklight/document/active_model_shim.rb +10 -0
- data/app/models/search.rb +6 -1
- data/app/services/blacklight/field_retriever.rb +13 -11
- data/app/views/catalog/_show_tools.html.erb +1 -0
- data/app/views/layouts/blacklight/base.html.erb +0 -3
- data/blacklight.gemspec +1 -2
- data/config/locales/blacklight.en.yml +1 -0
- data/lib/blacklight/component.rb +1 -1
- data/lib/blacklight/configuration.rb +10 -1
- data/lib/blacklight/engine.rb +12 -0
- data/lib/blacklight/solr/repository.rb +14 -2
- data/lib/blacklight/solr/search_builder_behavior.rb +2 -1
- data/lib/generators/blacklight/assets_generator.rb +1 -3
- data/lib/generators/blacklight/install_generator.rb +1 -3
- data/lib/generators/blacklight/templates/catalog_controller.rb +1 -0
- data/lib/generators/blacklight/templates/solr/conf/solrconfig.xml +69 -0
- data/lib/railties/blacklight.rake +4 -4
- data/package.json +2 -2
- data/spec/components/blacklight/document/sidebar_component_spec.rb +63 -0
- data/spec/components/blacklight/facet_component_spec.rb +11 -1
- data/spec/components/blacklight/facet_item_pivot_component_spec.rb +2 -2
- data/spec/components/blacklight/response/pagination_component_spec.rb +53 -0
- data/spec/components/blacklight/search_context/server_applied_params_component_spec.rb +11 -1
- data/spec/features/advanced_search_spec.rb +55 -0
- data/spec/features/axe_spec.rb +5 -0
- data/spec/helpers/blacklight_helper_spec.rb +10 -5
- data/spec/models/blacklight/configurable_spec.rb +1 -1
- data/spec/models/blacklight/solr/repository_spec.rb +27 -0
- data/spec/models/blacklight/solr/search_builder_spec.rb +8 -0
- data/spec/presenters/blacklight/show_presenter_spec.rb +4 -10
- data/spec/services/blacklight/field_retriever_spec.rb +17 -0
- data/spec/spec_helper.rb +29 -2
- data/spec/support/view_component_test_helpers.rb +14 -0
- data/spec/views/catalog/_paginate_compact.html.erb_spec.rb +2 -0
- metadata +11 -19
@@ -50,10 +50,6 @@ RSpec.describe Blacklight::ShowPresenter, api: true do
|
|
50
50
|
|
51
51
|
MockDocument.use_extension(MockExtension)
|
52
52
|
|
53
|
-
def mock_document_app_helper_url *args
|
54
|
-
solr_document_url(*args)
|
55
|
-
end
|
56
|
-
|
57
53
|
allow(request_context).to receive(:polymorphic_url) do |_, opts|
|
58
54
|
"url.#{opts[:format]}"
|
59
55
|
end
|
@@ -68,12 +64,10 @@ RSpec.describe Blacklight::ShowPresenter, api: true do
|
|
68
64
|
tmp_value = Capybara.ignore_hidden_elements
|
69
65
|
Capybara.ignore_hidden_elements = false
|
70
66
|
document.export_formats.each_pair do |format, _spec|
|
71
|
-
expect(subject).to have_selector("link[href$='.#{format}']") do |
|
72
|
-
expect(
|
73
|
-
tag
|
74
|
-
expect(tag
|
75
|
-
expect(tag.attributes["title"].value).to eq format.to_s
|
76
|
-
expect(tag.attributes["href"].value).to eq mock_document_app_helper_url(document, format: format)
|
67
|
+
expect(subject).to have_selector("link[href$='.#{format}']", count: 1) do |tag|
|
68
|
+
expect(tag["rel"]).to eq "alternate"
|
69
|
+
expect(tag["title"]).to eq format.to_s
|
70
|
+
expect(tag["href"]).to eq "url.#{format}"
|
77
71
|
end
|
78
72
|
end
|
79
73
|
Capybara.ignore_hidden_elements = tmp_value
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe Blacklight::FieldRetriever, api: true do
|
4
|
+
let(:service) { described_class.new(document, blacklight_field_config) }
|
5
|
+
|
6
|
+
let(:blacklight_field_config) { Blacklight::Configuration::Field.new(field: 'author_field', highlight: true) }
|
7
|
+
let(:document) { SolrDocument.new({ 'id' => 'doc1', 'title_field' => 'doc1 title', 'author_field' => 'author_someone' }, 'highlighting' => { 'doc1' => { 'title_tsimext' => ['doc <em>1</em>'] } }) }
|
8
|
+
let(:view_context) { {} }
|
9
|
+
|
10
|
+
context "highlighting" do
|
11
|
+
describe '#fetch' do
|
12
|
+
it "retrieves an author even if it's not highlighted" do
|
13
|
+
expect(service.fetch).to eq(['author_someone'])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,7 +17,6 @@ EngineCart.load_application!
|
|
17
17
|
require 'rspec/rails'
|
18
18
|
require 'rspec/collection_matchers'
|
19
19
|
require 'capybara/rails'
|
20
|
-
require 'webdrivers'
|
21
20
|
require 'selenium-webdriver'
|
22
21
|
require 'equivalent-xml'
|
23
22
|
require 'axe-rspec'
|
@@ -35,7 +34,7 @@ Capybara.register_driver :headless_chrome do |app|
|
|
35
34
|
opts.args << '--no-sandbox'
|
36
35
|
opts.args << '--window-size=1280,1696'
|
37
36
|
end
|
38
|
-
Capybara::Selenium::Driver.new(app, browser: :chrome,
|
37
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: capabilities)
|
39
38
|
end
|
40
39
|
|
41
40
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
@@ -119,3 +118,31 @@ RSpec.configure do |config|
|
|
119
118
|
# as the one that triggered the failure.
|
120
119
|
Kernel.srand config.seed
|
121
120
|
end
|
121
|
+
|
122
|
+
# RSpec's stub_template method needs a differnet implementation for Rails 7.1, that
|
123
|
+
# isn't yet in an rspec-rails release.
|
124
|
+
#
|
125
|
+
# First rspec-rails tried this:
|
126
|
+
# https://github.com/rspec/rspec-rails/commit/4d65bea0619955acb15023b9c3f57a3a53183da8
|
127
|
+
#
|
128
|
+
# But it was subject to this problem:
|
129
|
+
# https://github.com/rspec/rspec-rails/issues/2696
|
130
|
+
#
|
131
|
+
# Below implementation appears to work for our purposes here, so we will patch it in
|
132
|
+
# if we are on Rails 7.1+, and not yet rspec-rails 6.1 which we expect to have it.
|
133
|
+
|
134
|
+
if ::Rails.version.to_f >= 7.1 && Gem.loaded_specs["rspec-rails"].version.release < Gem::Version.new('6.1')
|
135
|
+
|
136
|
+
module RSpec
|
137
|
+
module Rails
|
138
|
+
module ViewExampleGroup
|
139
|
+
module ExampleMethods
|
140
|
+
def stub_template(hash)
|
141
|
+
controller.prepend_view_path(StubResolverCache.resolver_for(hash))
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
end
|
@@ -18,4 +18,18 @@ module ViewComponentTestHelpers
|
|
18
18
|
|
19
19
|
ApplicationController.new.extend(Rails.application.routes.url_helpers)
|
20
20
|
end
|
21
|
+
|
22
|
+
# Nokogiri 1.15.0 upgrades the vendored libxml2 from v2.10.4 to v2.11.3
|
23
|
+
# libxml2 v2.11.0 introduces a change to parsing HTML href attributes
|
24
|
+
# in nokogiri < 1.15, brackets in href attributes are escaped:
|
25
|
+
# - <a class="facet-select" rel="nofollow" href="/catalog?f%5Bz%5D%5B%5D=x:1">x:1</a>
|
26
|
+
# in nokogiri >= 1.15, brackets in href attributes are not escaped:
|
27
|
+
# - <a class="facet-select" rel="nofollow" href="/catalog?f[z][]=x:1">x:1</a>
|
28
|
+
# until we can spec a minimum nokogiri version of 1.15.0, we need to see how
|
29
|
+
# the installed version parsed the html
|
30
|
+
def nokogiri_mediated_href(href)
|
31
|
+
start = "<a href=\"".length
|
32
|
+
stop = -"\"></a>".length
|
33
|
+
Nokogiri::HTML.fragment("<a href=\"#{href}\"></a>").to_s[start...stop]
|
34
|
+
end
|
21
35
|
end
|
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
RSpec.describe "catalog/_paginate_compact.html.erb" do
|
4
4
|
let(:user) { User.new { |u| u.save(validate: false) } }
|
5
|
+
let(:blacklight_config) { Blacklight::Configuration.new }
|
5
6
|
|
6
7
|
before do
|
7
8
|
controller.request.path_parameters[:action] = 'index'
|
9
|
+
allow(controller).to receive(:blacklight_config).and_return(blacklight_config)
|
8
10
|
end
|
9
11
|
|
10
12
|
it "renders paginatable arrays" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: exe
|
19
19
|
cert_chain: []
|
20
|
-
date: 2023-
|
20
|
+
date: 2023-11-09 00:00:00.000000000 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rails
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
version: '2.66'
|
119
119
|
- - "<"
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: '
|
121
|
+
version: '4'
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
124
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -128,7 +128,7 @@ dependencies:
|
|
128
128
|
version: '2.66'
|
129
129
|
- - "<"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '4'
|
132
132
|
- !ruby/object:Gem::Dependency
|
133
133
|
name: rsolr
|
134
134
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,20 +205,6 @@ dependencies:
|
|
205
205
|
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '3'
|
208
|
-
- !ruby/object:Gem::Dependency
|
209
|
-
name: webdrivers
|
210
|
-
requirement: !ruby/object:Gem::Requirement
|
211
|
-
requirements:
|
212
|
-
- - ">="
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: '0'
|
215
|
-
type: :development
|
216
|
-
prerelease: false
|
217
|
-
version_requirements: !ruby/object:Gem::Requirement
|
218
|
-
requirements:
|
219
|
-
- - ">="
|
220
|
-
- !ruby/object:Gem::Version
|
221
|
-
version: '0'
|
222
208
|
- !ruby/object:Gem::Dependency
|
223
209
|
name: selenium-webdriver
|
224
210
|
requirement: !ruby/object:Gem::Requirement
|
@@ -771,6 +757,7 @@ files:
|
|
771
757
|
- spec/components/blacklight/constraints_component_spec.rb
|
772
758
|
- spec/components/blacklight/document/action_component_spec.rb
|
773
759
|
- spec/components/blacklight/document/group_component_spec.rb
|
760
|
+
- spec/components/blacklight/document/sidebar_component_spec.rb
|
774
761
|
- spec/components/blacklight/document_component_spec.rb
|
775
762
|
- spec/components/blacklight/document_metadata_component_spec.rb
|
776
763
|
- spec/components/blacklight/facet_component_spec.rb
|
@@ -781,6 +768,7 @@ files:
|
|
781
768
|
- spec/components/blacklight/header_component_spec.rb
|
782
769
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
783
770
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
771
|
+
- spec/components/blacklight/response/pagination_component_spec.rb
|
784
772
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
785
773
|
- spec/components/blacklight/response/view_type_component_spec.rb
|
786
774
|
- spec/components/blacklight/search_bar_component_spec.rb
|
@@ -881,6 +869,7 @@ files:
|
|
881
869
|
- spec/requests/load_suggestions_spec.rb
|
882
870
|
- spec/routing/catalog_routing_spec.rb
|
883
871
|
- spec/routing/search_history_spec.rb
|
872
|
+
- spec/services/blacklight/field_retriever_spec.rb
|
884
873
|
- spec/services/blacklight/search_service_spec.rb
|
885
874
|
- spec/spec_helper.rb
|
886
875
|
- spec/support/controller_level_helpers.rb
|
@@ -934,7 +923,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
934
923
|
- !ruby/object:Gem::Version
|
935
924
|
version: '0'
|
936
925
|
requirements: []
|
937
|
-
rubygems_version: 3.
|
926
|
+
rubygems_version: 3.4.21
|
938
927
|
signing_key:
|
939
928
|
specification_version: 4
|
940
929
|
summary: Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr)
|
@@ -945,6 +934,7 @@ test_files:
|
|
945
934
|
- spec/components/blacklight/constraints_component_spec.rb
|
946
935
|
- spec/components/blacklight/document/action_component_spec.rb
|
947
936
|
- spec/components/blacklight/document/group_component_spec.rb
|
937
|
+
- spec/components/blacklight/document/sidebar_component_spec.rb
|
948
938
|
- spec/components/blacklight/document_component_spec.rb
|
949
939
|
- spec/components/blacklight/document_metadata_component_spec.rb
|
950
940
|
- spec/components/blacklight/facet_component_spec.rb
|
@@ -955,6 +945,7 @@ test_files:
|
|
955
945
|
- spec/components/blacklight/header_component_spec.rb
|
956
946
|
- spec/components/blacklight/hidden_search_state_component_spec.rb
|
957
947
|
- spec/components/blacklight/metadata_field_component_spec.rb
|
948
|
+
- spec/components/blacklight/response/pagination_component_spec.rb
|
958
949
|
- spec/components/blacklight/response/spellcheck_component_spec.rb
|
959
950
|
- spec/components/blacklight/response/view_type_component_spec.rb
|
960
951
|
- spec/components/blacklight/search_bar_component_spec.rb
|
@@ -1055,6 +1046,7 @@ test_files:
|
|
1055
1046
|
- spec/requests/load_suggestions_spec.rb
|
1056
1047
|
- spec/routing/catalog_routing_spec.rb
|
1057
1048
|
- spec/routing/search_history_spec.rb
|
1049
|
+
- spec/services/blacklight/field_retriever_spec.rb
|
1058
1050
|
- spec/services/blacklight/search_service_spec.rb
|
1059
1051
|
- spec/spec_helper.rb
|
1060
1052
|
- spec/support/controller_level_helpers.rb
|